Python:print输出中文

python3 print输出unicode字符时出现以下错误:

UnicodeEncodeError: 'gbk' codec can't encode character '\u30fb

解决方法:

sys.stdout = io.TextIOWrapper(sys.stdout.buffer, errors = 'replace', line_buffering = True)

 

posted @ 2014-08-08 11:16  红尘一人  阅读(976)  评论(0编辑  收藏  举报