These are options that can be found under the Code dropdown menu. Both of them seem to arrange the code in a similar manner.
You can configure the IDE to rearrange code elements in modified files automatically when your changes are saved. Press Ctrl+Alt+S to open the IDE settings and select Tools | Actions on Save. Enable the Rearrange code option.
Reformat a code fragmentIn the editor, select a code fragment you want to reformat. Before reformatting, you can take a look at the code style settings that are applied to the selected code: press Alt+Enter and click Adjust code style settings. From the main menu, select Code | Reformat Code or press Ctrl+Alt+L .
Source Code Format means a form of computer program, or any portion thereof, written in a programming language employed by computer programmers that must be compiled or otherwise translated before it can be executed by a computer.
Reformat File dialog The dialog appears when you press Ctrl+Alt+Shift+L in the editor of the current file. If you choose Code | Reformat Code from the main menu or press Ctrl+Alt+L , PyCharm tries to reformat the source code of the specified scope automatically.
Rearranging code does more things than just reformat the code.
As mentioned in the docs, you can also change the placement of variables as well and define some custom rules which will be used when you rearrange the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With