相关文章推荐
叛逆的沙发  ·  Convert data ...·  1 月前    · 
沉稳的木瓜  ·  Python_PyCharm_Turtle- ...·  1 月前    · 
叛逆的长颈鹿  ·  offset commit failed ...·  1 月前    · 
胆小的奔马  ·  QTableWidget ...·  4 月前    · 
飘逸的饭卡  ·  connectionfactory ...·  7 月前    · 
留胡子的水龙头  ·  flutter - the ...·  1 年前    · 

安装后可以在Python安装目录下的Scripts文件夹中找到 autopep8.exe 。 拷贝该执行文件的路径,例如我的是 D:\Python_x64\Scripts\autopep8.exe

菜单栏 –>「File」–>「Settings」–>「Tools」–>「External Tools」–> 点击加号添加工具。 在program一栏对应填写刚刚记录的工具位置,然后按下表填写其他配置,其中 Output filters Advanced Options 中。

字段 配置项
Name autopep8
Program D:\Python_x64\Scripts\autopep8.exe
Arguments --in-place --aggressive --ignore=E123,E133,E50 $FilePath$
Working directory $ProjectFileDir$
Output filters $FILE_PATH$\:$LINE$\:$COLUMNS$\:.*

编写完代码后,在编码界面右键选择「Extern Tools」–>「atopep8」即可。

PS:在命令行中使用方式如下:

autopep8 –in-place –aggressive –aggressive [filename]

源代码的文件名中不要有空格