import urllib
from bs4 import BeautifulSoup
def scrape_data_site(url):
   f = urllib.urlopen(url)
   s = f.read()
   f.close()
   print "\t\t\t\t\tBerry\t\tHarris\t\tKarabell\tCockcroft"
   soup = BeautifulSoup(s)
   table=soup.findAll('table')[0] #finds the 2nd table
   rows = table.findAll('tr')
   for tr in rows:
      print "\n"
      cols = tr.findAll('td');
    
      for i,td in enumerate(cols):
           
           if not(i==0 or i==3 or i==8):
              if (i==1):
                 print "%24s" % (td.text),
              else:  
                 print td.text,
   
for week in (6,7):
   print "\n"
   print week, "\n"
   for position in ("QB", "RB", "WR", "TE", "K"):
      url="http://sports.espn.go.com/fantasy/football/ffl/story?page=12ranksWeek"+str(week)+str(position)
      print "\n"
      print position, "\n"
      scrape_data_site(url)     

"""       
url="http://sports.espn.go.com/fantasy/football/ffl/story?page=12ranksWeek2RB"
scrape_data_site(url)
"""
