I am trying to learn the basics of web scraping in python using beautiful soup. I came across code in a document. When I execute it there is an error. The code is:
import urllib2
from BeautifulSoup import BeautifulSoup
soup = BeautifulSoup(urllib2.urlopen('http://www.bcsfootball.org’).read())
for row in soup('table', {'class': 'mod-data’})[0].tbody('tr'):
tds = row('td')
print tds[0].string, tds[1].string
and the error is:
SyntaxError: Non-ASCII character '\xe2' in file ex.py on line 4, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
please help me solve this, and explain the line
for row in soup('table', {'class': 'mod-data’})[0].tbody('tr'):
most of the sites are giving the sample code, not explaining how it came and what is the meaning. It's a bit confusing, the terms like class, tbody etc. It will be really helpful if you could suggest any site or ebooks or anything