Autopep8是Python代码自动排版为PEP8风格的小工具。
安装autopep8
使用pip安装autopep8,如果没有pip请自行安装。
# 安装
pip install autopep8
# 验证
which autopep8
PyCharm配置
打开PyCharm,File-->setting--> tools-->external tools,点击加号添加。
Name: autopep8,也可以任意输入
Program: autopep8
Arguments: --in-place --aggressive --aggressive $FilePath$
Working directory:$ProjectFileDir$
测试
在工作区右键鼠标 External Tools 选择autopep8