SHARE
TWEET

lxml xpath parse table

reclosedev Apr 1st, 2012 594 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import lxml.html
  2.  
  3. doc = lxml.html.parse('test.html')
  4. rows = doc.xpath('//tr')
  5. data = [row.xpath('./*/text()') for row in rows]
RAW Paste Data
Want to get better at Python?
Learn to code Python in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top