I have a parse a web and now I want to navigate through the tags, or show a graph.
How can I get a graph? Or navigate through the tree. Showing the first step then other,etc. And understant how the tree was built.
import urllib
from lxml import etree
import StringIO
resultado=urllib.urlopen('trozo.html')
html = resultado.read()
parser= etree.HTMLParser()
tree=etree.parse(StringIO.StringIO(html),parser)
I only want to examine the nodes! A graph will be cool but I only want to examine it!
You achieved the parsing, which you can see if you do the following:
Now you can go through this element using
lxml._ElementTreefunctions, documented here: http://lxml.de/tutorial.htmlHere are some basics, with a simple file I got from my local network: