Skip to content

Instantly share code, notes, and snippets.

@takaki
Created October 26, 2012 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takaki/3957294 to your computer and use it in GitHub Desktop.
Save takaki/3957294 to your computer and use it in GitHub Desktop.
lxml, XPath, HTML
#!/usr/bin/python
from lxml import etree
tree = etree.HTML(open('a.html').read())
# //*[@id="companyTopData"]/div[2]/table/tbody/tr[1]/td
inv = tree.xpath('//*[@id="companyTopData"]/div[2]/table/tr[1]/td')
for i in inv:
print(i.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment