parse xhtml in python 2.6
xml.etree.ElementTree.parse is ch开发者_如何学编程oking on my xhtml file. I saw somewhere that lxml can handle html. Can someone tell me the documented way to parse, and then alter, xhtml? I want to add some javascript to xhtml on the fly.
Have you tried BeautifulSoup? It handles documents that aren't well formed and I've found it pretty good.
精彩评论