In lxml, I use xpath to select the whole tr in the table (which has a different number of rows), with the exception of the last two rows that contain gibberish.
Is there a pattern match that excludes the last two lines? I was looking through xpath tutorials and apparently there is an “except” statement as well as “last ()”, but it doesn't seem to work for my code to work.
While I have it. What can I add to this pattern to exclude the last two lines? The main problem is that the number tr is changing.
result = doc.xpath("//tr")
I think I could turn this into a list and just delete the last two elements, but is there an easier / more elegant solution?
Thanks in advance!
source
share