python3编码问题

遇到个问题,记录一下

python3中输出的问题:

UnicodeEncodeError: 'gbk' codec can't encode character '\xd0' in position 2: illegal multibyte sequence

解决方法:

import io
import sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf8')

 

posted @ 2018-02-04 12:16  hell0_w  阅读(80)  评论(0编辑  收藏