autopep8
- autopep8自动格式化Python代码以符合pep8样式指南。它使用pycodestyle实用程序来确定需要格式化代码的哪些部分。autopep8能够修复pycodestyle可以报告的大多数格式问题
- autopep8 automatically formats Python code to conform to the PEP 8 style guide. It uses the pycodestyle utility to determine what parts of the code needs to be formatted. autopep8 is capable of fixing most of the formatting issues that can be reported by pycodestyle.
安装autopep8:
pip install autopep8
使用autopep8
autopep8 --in-place --aggressive ./cal.py
- 意思是自动格式化cal.py的代码,将会覆盖原代码