正确的:
import io
import sys
import urllib.request
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='gb18030')
res=urllib.request.urlopen('http://www.baidu.com')
htmlBytes=res.read()
print(htmlBytes.decode('utf-8'))
import io
import sys
import urllib.request
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='gb18030')
res=urllib.request.urlopen('http://www.baidu.com')
htmlBytes=res.read()
print(htmlBytes.decode('utf-8'))
2018-01-09
报这个UnicodeEncodeError: 'gbk' codec can't encode character u'\xa9' in position 89190: illegal multibyte sequence错的改下cmd的print的编码就好
2018-01-09
没有人报这个错吗 报错:ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED]
解决办法:import ssl
ssl._create_default_https_context = ssl._create_unverified_context
解决办法:import ssl
ssl._create_default_https_context = ssl._create_unverified_context
2018-01-06
下载报错:UnicodeEncodeError:'ascii'编解码器不能编码11-13位置的字符:序号不在范围内(128)
2017-12-26
UnicodeEncodeError:'ascii'编解码器不能编码11-13位置的字符:序号不在范围内(128)
2017-12-26