指令行提示符下,python print輸出unicode字元時出現以下
- UnicodeEncodeError: 'gbk' codec can't encode character '\u30fb
不能輸出 unicode 字元,程式中斷。
解決方法:
- sys.stdout = io.TextIOWrapper(sys.stdout.buffer, errors = 'replace', line_buffering = True)
轉載于:https://www.cnblogs.com/kissfu/p/3848529.html