Created
January 6, 2012 16:06
-
-
Save jmg/1571205 to your computer and use it in GitHub Desktop.
lxml scraper example
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 | |
from StringIO import StringIO | |
import urllib2 | |
url = "http://www.ivao.aero/atcss/list.asp" | |
data = urllib2.urlopen(url).read() | |
parser = etree.HTMLParser() | |
tree = etree.parse(StringIO(data), parser) | |
table = tree.xpath("/html/body/div/center/table")[0] | |
for tr in table: | |
print [td[0].text for td in tr] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment