一、添加系统变量
在window环境变量中,添加环境变量 PYTHONIOENCODING
= UTF-8。
二、在文件中设置输出编码
import io import sys sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf8')
yunfeifei 2019-04-14 19:29 原文
一、添加系统变量
在window环境变量中,添加环境变量 PYTHONIOENCODING
= UTF-8。
二、在文件中设置输出编码
import io import sys sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf8')