stefan_ml at behnel.de
Mon Aug 24 09:13:14 CEST 2009
> I know how to turn HTML into an ElementTree object
I don't. ;)
ElementTree doesn't have an HTML parser, so what do you use for parsing?
> but I don't know
> how to then view the structure of this object. Is there a method or
> module that you can give an ElementTree object to, and it returns some
> kind of graphical or printed representation of the tree? Otherwise, if
> you can't see you're tree's structure, how do you know what is a
> sensible way of iterating over the tree to access the info you need?
ElementTree has a tostring() method that returns a string. To get a pretty
printed representation, you can use the indent() function from this recipe:
More information about the Python-list