Stripping HTML tags from a string

Colin Meeks colinmeeks at home.com
Wed May 2 14:34:57 EDT 2001


I know I've seen this somewhere before, but can't find it now I want it.
Does anybody know how to strip all HTML tags from a string. I imagine I
would use a regular expression, but am not fully up to speed on these yet.

i.e "<P>Hello<P><FONT FACE="Arial">This is really cool</FONT> isn't
it<BR>The End"
would give me "Hello This is really cool isn't it The End"
I would like to replace all <P> and <BR> with a space as this would result
in something that is more readable.

Many thanks in advance.

Colin





More information about the Python-list mailing list