Created
October 18, 2011 18:33
-
-
Save Gunio/1296255 to your computer and use it in GitHub Desktop.
Parsing HTML in Python with LXML
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 | |
import lxml | |
from lxml import html | |
r = requests.get('http://gun.io') | |
tree = lxml.html.fromstring(r.content) | |
elements = tree.get_element_by_id('frontsubtext') | |
for el in elements: | |
print el.text_content() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment