跳转到内容

欢迎来到Riguz的小站!这是一个私人wiki,用来记录一些我的笔记。

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)