python print输出unicode字符

命令行提示符下,python print输出unicode字符时出现以下

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


不能输出 unicode 字符,程序中断。

解决方法:

  1. sys.stdout = io.TextIOWrapper(sys.stdout.buffer, errors = 'replace', line_buffering = True)
posted @ 2014-07-16 14:05  亲福  阅读(3004)  评论(0编辑  收藏  举报