I was wondering if there exists a sort of Python beautifier like the gnu-indent command line tool for C code. Of course indentation is not the point in Python since it is programmer's responsibility but I wish to get my code written in a perfectly homogenous way, taking care particularly of having always identical blank space between operands or after and before separators and between blocks.
I am the one who asks the question. In fact, the tool the closest to my needs seems to be PythonTidy (it's a Python program of course : Python is best served by himself ;) ).
autopep8 attempts to automate making your code conform to pep8 coding standards
PyLint has some formatting checks.
Have you looked at pindent?
来源:https://stackoverflow.com/questions/1032393/python-formatter-tool