Created
July 30, 2012 04:02
-
-
Save utsavsabharwal/3204331 to your computer and use it in GitHub Desktop.
How to fetch information from a html page using xpath in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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