Web scraping with Python -
i'd grab daily sunrise/sunset times web site. possible scrape web content python? modules used? there tutorial available?
use urllib2 in combination brilliant beautifulsoup library:
import urllib2 beautifulsoup import beautifulsoup # or if you're using beautifulsoup4: # bs4 import beautifulsoup soup = beautifulsoup(urllib2.urlopen('http://example.com').read()) row in soup('table', {'class': 'spad'})[0].tbody('tr'): tds = row('td') print tds[0].string, tds[1].string # print date , sunrise
Comments
Post a Comment