python3报错UnicodeEncodeError
本帖最后由 yakczh_cu 于 2014-06-19 19:25 编辑import urllib.request as request
from bs4 import BeautifulSoup
url='https://github.com/joyent/node/wiki/Projects,-Applications,-and-Companies-Using-Node'
#url='http://www.cityhouse.cn/default/leaserank.html'
soup=BeautifulSoup(request.urlopen(url),from_encoding='utf-8')
tables=soup.find_all('table')
for table in tables:
print(table)
print(table)
UnicodeEncodeError: 'gbk' codec can't encode character '\xa0' in position 38: illegal multibyte sequence
但是如果换成其他的utf8编码的url,输出又是正常的
页:
[1]