Python学习笔记(4):Pycharm 安装 Autopep8 工具(Windows)

Autopep8是Python代码自动排版为PEP8风格的小工具。

  • PEP 8官方文档 -- Style Guide for Python Code
  • PEP8中文翻译(转)

(1)使用pip安装Autopep8
如果没有安装pip,参照上一篇学习笔记Python学习笔记(2):pip的安装(Winindows)。
打开命令行,输入

 pip install autopep8

如图:


(2)PyCharm设置
打开PyCharm,File-->setting--> tools-->external tools,点击加号添加。
Name: autopep8,也可以任意输入
Program: autopep8
Arguments: --in-place --aggressive --aggressive $FilePath$
Working directory:$ProjectFileDir$

(3)安装完成,进行测试
设置OK之后,重启Pycharm。随便写一段不符合规范的代码,看使用效果。

测试前

使用Autopep8

测试成功

你可能感兴趣的:(Python学习笔记(4):Pycharm 安装 Autopep8 工具(Windows))