Python:print输出中文

来自WHY42

python3 print在win平台下输出unicode字符时出现以下错误:

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

解决方法:

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