Created
May 7, 2017 17:12
-
-
Save logan4dog/62c4067d3ebc577e20eeba807a86370c to your computer and use it in GitHub Desktop.
lxml xpath web scraping for the interior dept page table of monuments Donald J Trump wants to reduce in size or elimate all together
This file contains 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
import requests | |
from lxml import html | |
pageContent=requests.get('https://www.doi.gov/pressreleases/interior-department-releases-list-monuments-under-review-announces-first-ever-formal') | |
tree = html.fromstring(pageContent.content) | |
#monument | |
tree.xpath('//*[@property="content:encoded"]//tr/td[1]/text()') | |
#location | |
tree.xpath('//*[@property="content:encoded"]//tr/td[2]/text()') | |
#years | |
tree.xpath('//*[@property="content:encoded"]//tr/td[3]/text()') | |
#acreage | |
tree.xpath('//*[@property="content:encoded"]//tr/td[4]/text()') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment