python3 print输出unicode字符时出现以下错误:
UnicodeEncodeError: ‘gbk‘ codec can‘t encode character ‘\u30fb
解决方法:
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, errors = ‘replace‘, line_buffering = True)
Python:print输出中文
时间: 2024-10-12 16:18:47
python3 print输出unicode字符时出现以下错误:
UnicodeEncodeError: ‘gbk‘ codec can‘t encode character ‘\u30fb
解决方法:
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, errors = ‘replace‘, line_buffering = True)
Python:print输出中文