Python:Charmap Codec Unicode编码错误

时间:2013-11-16 20:55:07

标签: python python-3.x beautifulsoup

当我运行以下代码时,

import urllib.request, urllib.parse, urllib.error
from bs4 import BeautifulSoup
url= "http://couponmaths.com"
htmltext = urllib.request.urlopen(url).read()
soup = BeautifulSoup(htmltext)
print(soup.get_text())
print(soup.prettify())

我收到错误:

UnicodeEncodeError: 'charmap' codec can't encode character '\u201c' in position 16975: character maps to <undefined>

有人可以帮我解决这个问题吗?

0 个答案:

没有答案