continuation line missing indentation or outdented 這個坑爹的校驗也是沒誰了

PyCharm配置autopep8,自動格式化Python代碼

1. 關於PEP 8python

PEP 8,Style Guide for Python Code,是Python官方推出編碼約定,主要是爲了保證 Python 編碼的風格一致,提升代碼的可讀性。git

官網地址:https://www.python.org/dev/peps/pep-0008/github

2. 關於Autopep8ide

Autopep8是自動將Python代碼格式化爲符合PEP 8風格的工具。它使用pycodestyle工具來肯定代碼的哪些部分須要被格式化。Autopep8可以修復大部分pycodestyle檢測的格式問題。工具

github地址:https://github.com/hhatto/autopep8ui

3. 下載安裝Autopep8編碼

pip install autopep8spa

4. 使用Autopep8命令行

命令行使用方式以下code

autopep8 --in-place --aggressive --aggressive  文件名

5. Pycharm配置Autopep8方法

1)選擇菜單「File」–>「Settings」–>「Tools」–>「External Tools」–>點擊加號添加工具

2)填寫以下配置項,點擊「OK」保存

Name:Autopep8 (可隨意填寫)

Tools settings:

    Programs:autopep8

    Parameters:--in-place --aggressive --ignore=E123,E133,E50 $FilePath$

    Working directory:$ProjectFileDir$

3) 選擇菜單「Tool」–>「Extern Tools」–>「Autopep8」便可使用autopep8自動格式化你的python代碼了

相關文章
相關標籤/搜索