title: How to automatically format Python files in VS Code?
body: <p><a href="https://i.stack.imgur.com/blafb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/blafb.png" alt="enter image description here" /></a>I'm very confused about how it automatically format code in VS Code.</p>
  <p>Below is a very clean, brand new environment for using Python.</p>
  <p>When I write a test.py and press Save, prompt me for this information in the lower right corner, but I have installed these globally.</p>
  <p>I had read this <a href="https://stackoverflow.com/questions/64901525/automatically-reformat-python-code-in-vs-code">Automatically reformat Python code in VS Code</a> . However , I can't comment it.</p>
  <p>My workspace `settings.json`</p>
  <pre><code>{
    &quot;editor.formatOnSave&quot;: true,
    &quot;editor.codeActionsOnSave&quot;: {
      &quot;source.fixAll&quot;: true,
      &quot;source.fixAll.eslint&quot;: true
    },
    &quot;python.defaultInterpreterPath&quot;: &quot;C:\\Users\\admin\\anaconda3&quot;,
    &quot;python.linting.enabled&quot;: true,
    &quot;python.linting.pylintEnabled&quot;: true,
    &quot;python.linting.lintOnSave&quot;: true,
    &quot;python.linting.pycodestyleEnabled&quot;: true,
    &quot;python.linting.flake8Enabled&quot;: true,
    &quot;python.formatting.provider&quot;: &quot;autopep8&quot;,
    &quot;python.languageServer&quot;: &quot;Pylance&quot;,
    &quot;[python]&quot;: {
      // &quot;editor.defaultFormatter&quot;: &quot;ms-python.python&quot;,
      &quot;editor.formatOnSave&quot;: true,
    },
  }
  </code></pre>