Answer the question
In order to leave comments, you need to log in
Working with Element table in lxml
For personal needs, I needed a small report parser.
On Habré, just at that moment they wrote about LXML and how fast it works. I decided to try to make it beautiful.
As a result stuck with Element table.
PR= xml =lxml. html . document_fromstring ( open ( 'test.html' ) . read ( ) . decode ( 'utf-8' ) )
i = 1
while True :
table = PR. xpath ( '/html/body/table[' + str ( i ) + ']' )
if not table:
break
i += 1
print table
Answer the question
In order to leave comments, you need to log in
Or you can take pyquery , which is a small wrapper on top of lxml, but write in a more, IMHO, convenient style of css selectors .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question