python 无法使用setdefaultencoding方法
其他问答
1
import requests
import re
import sys
reload(sys)
sys.setdefaultencoding("gb18030")
type = sys.getfilesystemencoding()
html = requests.get('http://jp.tingroom.com/yuedu/yd300p/')
print html.text
执行报错:
Traceback (most recent call last):
File "C:/Users/sh/PycharmProjects/untitled/regao_yuandaima.py", line 21, in
print html.text
UnicodeEncodeError: 'gbk' codec can't encode character u'\xe7' in position 252: illegal multibyte sequence
发表回复