Reformat Code

Tell PyCharm to clean up indentation and other code style in your file.

If re-indenting your code or fixing long lines doesn't sound fun, let PyCharm do it for you.

If there's one action that you'll do constantly, it's this one: Reformat Code makes it a piece of cake to fix style warnings.

In Depth

Perhaps you copy and pasted some code with a different line length than your other code. Or you join a project where the other have sinned against all the gods with their heretical indentation spacing. Tabs?!

PyCharm makes it easy to set code styles in wildly flexible ways (project vs. IDE, EditorConfig files, inline markers to suppress, etc.) But PyCharm makes it even easier to apply those code styles with the Reformat Code action.

This action has an easy shortcut and can be applied to an entire file, a selection, or across many files in the project. With PyCharm Professional, you can also use it outside of Python, in JavaScript, CSS, etc.

Full Video