Skip to content

Instantly share code, notes, and snippets.

@tcash21
Created July 19, 2013 22:00
Show Gist options
  • Save tcash21/6042650 to your computer and use it in GitHub Desktop.
Save tcash21/6042650 to your computer and use it in GitHub Desktop.
import csv
import re
import urllib2
from bs4 import BeautifulSoup
page = urllib2.urlopen("http://fantasyfootballcalculator.com/completed_drafts.php?format=standard").read()
soup = BeautifulSoup(page)
#print soup.prettify()
li = []
for link in soup.find_all("a"):
li.append(link.get("href"))
def filtah(x):
return x.startswith("draft")
newlist = filter(filtah, li)
for draft in newlist:
page = urllib2.urlopen("http://fantasyfootballcalculator.com/" + draft)
soup = BeautifulSoup(page)
table = soup.find('tbody', attrs={"id": "draftboardBody"})
rows = table.findChildren(['tr'])
for row in rows:
rounds = row.find('td', {"class": "rowLabel"})
for round in rounds:
value = round.string
print "value is %s" % value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment