Want more features on Pastebin? Sign Up, it's FREE!
Guest

lxml xpath parse table

By: reclosedev on Apr 1st, 2012  |  syntax: Python  |  size: 0.13 KB  |  views: 282  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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]
clone this paste RAW Paste Data