Stripping HTML with RE

Miles Fender miles_f at yahoo.com
Wed Nov 10 00:20:29 CET 2004


Steveo wrote:
> I am currently stripping HTML from a string with the following code. 
> (I know it's not the best way to strip HTML but bear with me)
 > [...]

Instead of using REs, you might consider the StrippingParser
from the Python Cookbook:

   http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52281

It allows you to specify explicitly which tags you want to leave
intact, so you'll be able to change your mind later without futzing
about with a complex RE...


Miles



More information about the Python-list mailing list