- On the main menu, choose , or press Ctrl+Alt+L.
- In the Reformat Code dialog box, specify the reformatting scope:
- The current file.
- Selected text.
- All files in the current directory, including or omitting subdirectories.
- Click Run.
You can reformat source code to meet the requirements of your code style. PyCharm will lay out spacing, indents, keywords etc.
Reformatting can apply to the selected text, entire file, or entire project.