Pyhton中的数据刮擦。 代码工作正常,但它显示了我在下面提到的错误。 可能是什么原因?Python Data Scraping
import urllib2
from bs4 import BeautifulSoup
from xlwt import workbook
wb = Workbook()
sheet1 = wb.add_sheet('Sheet1')
soup = BeautifulSoup(urllib2.urlopen("http://en.wikipedia.org/wiki/List_of_Indian_satellites").read())
for row in soup('table', {'class': 'wikitable sortable jquery-tablesorter’})[0].tbody('tr'):
tds = row('td')
sheet1.write(row, 0, tds[0].string)
sheet2.write(row, 1, tds[1].string)
wb.save('Performance Project.xls')
Error: File "ProcessingProject.py", line 12 SyntaxError: Non-ASCII character '\xe2' in file ProcessingProject.py on line 12
但没有编码声明;见http://python.org/dev/peps/pep-0263/的细节