用于查看python代码是否符合风格.
安装方法
sudo apt-get install pep8
使用
pep8 --first youfile.py
可以得到以下输出 (DbRouter.py是自己写的一个文件):
DbRouter.py:4:7: E271 multiple spaces after keyword
DbRouter.py:15:11: E225 missing whitespace around operator
DbRouter.py:26:13: W291 trailing whitespace
DbRouter.py:30:1: E302 expected 2 blank lines, found 1
DbRouter.py:39:13: E231 missing whitespace after ','
DbRouter.py:47:47: E228 missing whitespace around modulo operator
DbRouter.py:47:80: E501 line too long (82 > 79 characters)
DbRouter.py:52:1: W293 blank line contains whitespace
DbRouter.py:71:16: E272 multiple spaces before keyword
DbRouter.py:77:9: E303 too many blank lines (3)
DbRouter.py:15:11: E225 missing whitespace around operator
DbRouter.py:26:13: W291 trailing whitespace
DbRouter.py:30:1: E302 expected 2 blank lines, found 1
DbRouter.py:39:13: E231 missing whitespace after ','
DbRouter.py:47:47: E228 missing whitespace around modulo operator
DbRouter.py:47:80: E501 line too long (82 > 79 characters)
DbRouter.py:52:1: W293 blank line contains whitespace
DbRouter.py:71:16: E272 multiple spaces before keyword
DbRouter.py:77:9: E303 too many blank lines (3)
显示的就是出现的一些规范的内容,即使是打多打少几个空格也会被提示