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

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -