首先判断是否是Code Runner插件导致的乱码。

假设是Code Runner插件的问题,测试一下其他编译是否有乱码。
法1:
    右键运行python文件在终端(Run python file at the terminal)
法2:
    F5调试
其他方法没有乱码,使用Code Runner编译,乱码。

我的解决方法:

      进入settings界面VScode python使用Code Runner插件乱码问题

二选一:

在括号中加"code-runner.runInTerminal": true即可(在终端输出),

或是新建一个code-runner.executorMap(在OUTPUT输出):

    // "code-runner.runInTerminal": true
    "code-runner.executorMap": {
        // "python": "$pythonPath -u $fullFileName",
        "python": "set PYTHONIOENCODING=utf8 && python",
    },

 

或是ctrl+,进入settings界面
或是ctrl+shift+p找到user settings

VScode python使用Code Runner插件乱码问题

小结(win10系统):
    运行爬虫代码,在终端显示没有在OUTPUT上显示的更舒服

 

 

参考链接:

https://stackoverflow.com/questions/50689210/how-to-setup-code-runner-in-visual-studio-code-for-python

 

 

相关文章: