Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Formatter Tool

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.

like image 227
user127555 Avatar asked Jun 23 '09 12:06

user127555


People also ask

How do I import a formatter in Python?

File: formatter-example-1.py import formatter import htmllib w = formatter. AbstractWriter() f = formatter. AbstractFormatter(w) file = open("samples/sample. htm") p = htmllib.

What is Python autopep8?

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.

What is Python YAPF?

A formatter for Python files.


1 Answers

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 ;) ).

like image 189
candide Avatar answered Sep 17 '22 13:09

candide