Skip to content

Instantly share code, notes, and snippets.

@utsavsabharwal
Created July 30, 2012 04:02
Show Gist options
  • Select an option

  • Save utsavsabharwal/3204331 to your computer and use it in GitHub Desktop.

Select an option

Save utsavsabharwal/3204331 to your computer and use it in GitHub Desktop.
How to fetch information from a html page using xpath in python
from lxml import etree
tree = etree.HTML(html_content)
result = tree.xpath('.//*[@id="BVRRRatingSummarySourceID"]/div/div/div/div[1]/span/span/text()')
#result might be an array or just text depending upon what xpath was
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment