import urllib2
from BeautifulSoup import BeautifulSoup
contenturl = "http://espnfc.com/tables/_/league/esp.1/spanish-la-liga?cc=5901"
soup = BeautifulSoup(urllib2.urlopen(contenturl).read())
table = soup.find('div id', attrs={'class': 'content'})
rows = soup.findAll('tr')
for tr in rows:
cols = tr.findAll('td')
for td in cols:
text = td.find(text=True)
print text,
print
and I get: (note this is only a little bit of what I was looking for, which are standings for a soccer league)
Overall None Home None Away None
POS None TEAM P W D L F A None W D L F A None W D L F A None GD Pts
1
Barcelona 38 32 4 2 115 40 None 18 1 0 63 15 None 14 3
My question is, Why is there a "None" after every word? Is there a way I can make it stop doing that?