Newby: How do I strip HTML tags?
Andy McKay
amckay at merlintechnologies.com
Fri Jun 7 13:07:19 EDT 2002
> This is a quite straight forward function:
This of course assumes that there are no "<" or ">" anywhere else in
attributes etc...
I would recommend using HTML Parser to get an accurate representation, or
even stripogram which is pretty good (note it doesnt need Zope at all),
although the html2text isnt perfect:
>>> from stripogram import html2text
>>> html2text("<b>This is a <i>test</i></b>")
'This is a test'
--
Andy McKay
Merlin Technologies
More information about the Python-list
mailing list