Pep8 is a tool to check your Python code against some of the style conventions in PEP 8.
For more info check this out:
You can install pep8 using pip
$ pip install pep8
Here you are checking the file optparse.py to see if it has any errors. This will only give you the pep8 error and the line on which the error occurs. The ‘–first’ will only show you the first occurrence of each error.
$ pep8 –first optparse.py
If you also want to see the code which has the error along with the pep8 error. The file E40.py is being checked.
$ pep8 –show-source –show-pep8 testsuite/E40.py
Autopep8 automatically formats Python code to conform to the PEP 8 style guide. Autopep8 is capable of fixing most of the formatting issues that can be reported by pep8. Also autoppep8 is awesome (USE IT!!!!!)
$ pip install autopep8
$autopep8 –in-place –aggressive –aggressive <filename>
-i, --in-place make changes to files in place
-a, --aggressive enable non-whitespace changes; multiple -a result in more aggressive changes )