How do I convert escaped HTML into a string?

leej at citymutual.com leej at citymutual.com
Sat Nov 24 08:24:51 EST 2007


On 24 Nov, 05:42, "Just Another Victim of the Ambient Morality"
<ihates... at hotmail.com> wrote:

> I did find some people who complained about this and rolled their own
> solution but I refuse to believe that Python doesn't have a built-in
> solution to what must be a very common problem.

<snip>

Replace "python" with "c++" and would that seem a reasonable belief?
(That said I'm a PyN00b)

Anyways, for all my HTML processing needs my first port of call has
been BeautifulSoup e.g.

soup = BeautifulSoup(html, convertEntities="html")
print soup.findAll(text=True)

Should be in the ballpark of what you want.

http://www.crummy.com/software/BeautifulSoup/documentation.html for
docs.



More information about the Python-list mailing list