UnicodeEncodeError: 'gbk' codec can't encode character '\xa0' in position 263: i
llegal multibyte sequence
UnicodeEncodeError: 'gbk' codec can't encode character '\x??' in position ?: illegal multibyte sequence
这个是在Win8上用Python3编译的时候遇到的,原因是win8的python3的默认编码不是utf8,我们只需要将默认编码改为utf8就能解决这个问题,参见下面的代码:
import sys, io sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf8') # Change default encoding to utf8