[Tutor] Stripping HTML tags.

Dave S pythontut at pusspaws.net
Fri Apr 16 17:19:08 EDT 2004


Hello,

I need to strip HTML tags from a string called "stockdata". I have come 
up with ...

import re
.....
# Hack out the HTML tags to save room on the drive
rematch=re.compile('<[^>]*>')
stockdata=rematch.sub('',stockdata)
....

It works but seems a bit messy. Is there a neater way to do this ?

Dave



More information about the Tutor mailing list