【Python】【VS Code】python.json和setting.json配置说明

目录

1. python.json配置

2. setting.json配置

3. 解决中文乱码

4. 实现效果


1. python.json配置

         此为VS Code的头文件设置,用法:编辑一个.py文件,输入pyheader,就可以补全以下内容啦

{
    "HEADER":{
    "prefix": "pyheader",
    "body": [   
    "#!/usr/bin/env python3",
    "# _*_ coding : UTF-8 _*_",
    "# 开发团队 :ALL",
    "# 开发人员 :Admin",
    "# 开发时间 :$CURRENT_YEAR/$CURRENT_MONTH/$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
    "# 文件名称 :$TM_FILENAME",
    "# 开发工具 :Visual Studio Code",
    "",
    "",
    "",
    "if __name__ == '__main__':",
    "$0"
    ],
    }
}

2. setting.json配置

        此为VS Code的头文件设置,涉及到环境配置、代码颜色、行间距、字体粗细、中文环境配置等待

{
    "security.workspace.trust.untrustedFiles": "open",
    "workbench.colorTheme": "Oceanic Next (dimmed bg)",
    "workbench.iconTheme": "material-icon-theme",
    "bracket-pair-colorizer-2.depreciation-notice": false,
    "editor.lineHeight": 24,      //控制行间距
    "editor.fontWeight": "normal",    // 控制字体粗细
    "editor.tokenColorCustomizations": {"comments": "#00ff7f",
    "keywords": "#eb6689",
    "numbers": "#00eeff",
    "functions": "#ea65f9"
    },  //控制字体颜色
    "python.defaultInterpreterPath": "D:\\soft\\Anaconda3\\python.exe",
    //"python.linting.flake8Enabled": true,
    //"python.formatting.provider": "yapf",
    //"python.linting.flake8Args": ["--max-line-length=248"],
    //"python.linting.pylintEnabled": false,
    "python.autoComplete.extraPaths": ["D:/soft/Anaconda3/lib/site-packages",],
    "python.analysis.extraPaths": ["D:/soft/Anaconda3",],
    //"vsicons.dontShowNewVersionMessage": true,
    // 配置python语言正常输出中文的环境
    "code-runner.executorMap": {
    "python":"set PYTHONIOENCODING=utf8 && $pythonPath -u $fullFileName"}, 
    "code-runner.respectShebang": false,
    "editor.unicodeHighlight.includeStrings": false,
    "editor.unicodeHighlight.includeComments": false,
//终端颜色配置
    "terminal.integrated.inheritEnv": false,
    "workbench.colorCustomizations": {
        "terminal.background": "#200707",
        "terminal.foreground": "#b4d6af",
        "terminalCursor.background": "#D8D8D8",
        "terminalCursor.foreground": "#D8D8D8",
        "terminal.ansiBlack": "#181818",
        "terminal.ansiBlue": "#0b5e7c",
        "terminal.ansiBrightBlack": "#585858",
 
// 终端命令行  lm@os:
        "terminal.ansiBrightBlue": "#39b9e7",
        "terminal.ansiBrightCyan": "#86C1B9",
        "terminal.ansiBrightGreen": "#ca530f",
        "terminal.ansiBrightMagenta": "#BA8BAF",
        "terminal.ansiBrightRed": "#AB4642",
        "terminal.ansiBrightWhite": "#F8F8F8",
        "terminal.ansiBrightYellow": "#f788f7",
        "terminal.ansiCyan": "#86C1B9",
        "terminal.ansiGreen": "#b57b6c",
        "terminal.ansiMagenta": "#BA8BAF",
        "terminal.ansiRed": "#AB4642",
        "terminal.ansiWhite": "#D8D8D8",
        "terminal.ansiYellow": "#F7CA88",
        "terminal.integrated.cursorBlinking": true,
        "terminal.integrated.lineHeight": 1.6,
        "terminal.integrated.letterSpacing": 0.1,
        "terminal.integrated.fontFamily": "Lucida Console", //字体设置
        "terminal.integrated.shell.linux": "/bin/zsh",
    },
    "[python]": {
        "editor.formatOnType": true
    },
    "vsicons.dontShowNewVersionMessage": true,
    "settingsSync.ignoredExtensions": [
    
    ],
    "settingsSync.ignoredSettings": [

    ],
    "window.zoomLevel": -1,
    "editor.codeActionsOnSave": {
    
    }
}

3. 解决中文乱码

        在setting.json文件里面增加以下内容即可

// 配置python语言正常输出中文的环境
"code-runner.executorMap": {
    "python":"set PYTHONIOENCODING=utf8 && $pythonPath -u $fullFileName"}, 
"code-runner.respectShebang": false
},

4. 实现效果

相关推荐

  1. axios配置以及说明

    2024-02-18 12:30:04       19 阅读
  2. mysql 配置说明

    2024-02-18 12:30:04       13 阅读
  3. 6 Zookeeper 配置说明

    2024-02-18 12:30:04       13 阅读
  4. RocketMQ:broker配置说明

    2024-02-18 12:30:04       8 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-02-18 12:30:04       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-02-18 12:30:04       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-02-18 12:30:04       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-02-18 12:30:04       20 阅读

热门阅读

  1. html5移动端适配;检测浏览器信息函数

    2024-02-18 12:30:04       32 阅读
  2. C语言系列9——动态内存分配与释放

    2024-02-18 12:30:04       34 阅读
  3. CCF编程能力等级认证GESP—C++4级—20231209

    2024-02-18 12:30:04       50 阅读
  4. ADO世界之SECOND

    2024-02-18 12:30:04       27 阅读
  5. RTC时钟

    RTC时钟

    2024-02-18 12:30:04      24 阅读
  6. 微信支付后台返回注意点

    2024-02-18 12:30:04       29 阅读
  7. 【C语言 学习记录】七、指针

    2024-02-18 12:30:04       30 阅读