Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple example of how to parse a page with python
import urllib2
from bs4 import BeautifulSoup
page = urllib2.urlopen('http://www.bbc.co.uk/sport/football/tables')
soup = BeautifulSoup(page)
rows = soup.find_all('tr')
for row in rows:
team = row.find('td', class_='team-name')
if team:
print(team.get_text())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment