VScode格式化python代码

四十四 / 2024-01-22 / 原文

  1. 在拓展中搜索"Black Formatter"并安装

  2. 在JSON(User) 文件中添加配置,打开settings.json并添加:

    "[python]": {
        "editor.defaultFormatter": "ms-python.black-formatter",
        "editor.formatOnSave": true
    }