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代码了

相关文章
相关标签/搜索