insert comments into elementtree

Stefan Behnel stefan.behnel-n05pAM at web.de
Fri Nov 16 13:20:11 EST 2007


Tim Arnold wrote:
> Hi, I'm using the TidyHTMLTreeBuilder to generate some elementtrees from 
> html. One by-product is that I'm losing comments embedded in the html.

That's how the parser in ET works. Use lxml instead, which keeps documents
intact while parsing.

http://codespeak.net/lxml/dev/
http://codespeak.net/lxml/dev/lxmlhtml.html

Stefan



More information about the Python-list mailing list