Newby: How do I strip HTML tags?

Gerson Kurz gerson.kurz at t-online.de
Sat Jun 8 07:08:36 CEST 2002


On Fri, 7 Jun 2002 10:07:19 -0700, Andy McKay wrote:

>This of course assumes that there are no "<" or ">" anywhere else in
>attributes etc...

Standalone "<" and ">" indicate invalid HTML code, one should use <
and > instead. You are of course right, in the end a use of
predefined classes is almost always better than reinventing the wheel
yourself.

>>>> html2text("<b>This is a <i>test</i></b>")
>'This is a test'

Works with both of my funcs, too ;)

Cheers,
Gerson 




More information about the Python-list mailing list