Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

lxml xpath parse table

By: reclosedev on Apr 1st, 2012  |  syntax: Python  |  size: 0.13 KB  |  hits: 223  |  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]