目录
方法一:每次都要加
方法二:一劳永逸
方法一
在程序中加入如下代码强行控制输出格式为utf-8即可
# -*- coding: utf-8 -*-
import sys
import io
sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding='utf8')#改变默认输出的标准编码
编码改变之前
编码改变之后
方法二
可以通过设置编译参数,指定使用UTF-8编码
在设置文件中修改这个选项
"code-runner.executorMap": {
.....
"python": "set PYTHONIOENCODING=utf8 && python -u",
.....
}