The code automatically fills in the Spaces

The problem

When using PyCharm’s code editor, it is often lazy to write whitespace, as shown below, but this is not in line with the code specification and also affects readability.

The solution

Pycharm has a shortcut to automatically format your code. The default isAlt+Ctrl+L, the code automatically fills in the space after pressing the shortcut key.

Automatic alignment code

The problem

When using pyCharm’s code editor, it is sometimes possible to copy code that is not aligned to the code format, as shown below, but this does not conform to the code specification and can affect readability.

The solution

Pycharm has a shortcut to automatically format your code. The default isAlt+Ctrl+L, place the cursor on the line of code you want to adjust, or select an area and press the shortcut key to automatically align the code.

Select all the same characters

Shortcut key combination:Ctrl + Shift + Alt + J

Select the next same character

Shortcut key combination:Alt + J

Batch indentation

Select code areaTABdedentshit+TAB



Select and press Tab:

other

The first are the most common, but there are many pyCharm shortcuts that you can use.

The referencecard.pdf shortcut description can be found in the PyCharm /opt/ PyCharm -3.4.1/help directory

Here are some of the more common shortcuts for tweaking code

Auto-tuning code instructions
Alt+Enter Automatically adding packages
shift+O Automatically suggest code completion
Ctrl+t SVN update
Ctrl+k SVN submit
Ctrl + / Comment (uncomment) the selected line
Ctrl+Shift+F Advanced search
Ctrl+Enter completion
Shift + Enter To start a new line
TAB Shift+TAB Indent/unindent the selected line
Ctrl + Alt + I Automatic shrinking
Ctrl + Y Deletes the row where the current caret is located
Ctrl + D Copies the current row, or the selected block
Ctrl + Shift + J Merge rows
Ctrl + Shift + V Paste from the nearest cache
Ctrl + Delete Delete to the end of the character
Ctrl + Backspace Delete to the beginning of the character
Ctrl + NumPad+/- Expand or shrink a block of code
Ctrl + Shift + NumPad+ Expand all the code blocks
Ctrl + Shift + NumPad- Shrink all blocks of code
Ctrl + N Jump to the class
Ctrl + Shift + N Jump to symbol
Alt + Right/Left Skip to the next, previous edit TAB
F12 Go back to the previous tools window
Esc Go back to the Edit window from the Tools window
Shift + Esc Hide running, recently running Windows
Ctrl + Shift + F4 Close the active running TAB
Ctrl + G View the current line number and character number
Ctrl + E Current file popup
Ctrl+Alt+Left/Right Back, forward
Ctrl+Shift+Backspace Navigate to the most recently edited area
Alt + F1 Finds the current file or identity
Ctrl+B / Ctrl+Click Jump to declaration
Ctrl + Alt + B Jump to Implementation
Ctrl + Shift + I View quick Definitions
Ctrl + Shift + B Jump to the type declaration
Ctrl + U Jump to parent method, parent class
Alt + Up/Down Jump to the previous or next method
Ctrl + ]/[ Jump to end, start of code block
Ctrl + F12 Pop-up file structure
Ctrl + H Type hierarchy
Ctrl + Shift + H Method hierarchy
Ctrl + Alt + H Call hierarchy
F2 / Shift + F2 The next and previous highlighted errors
F4 / Ctrl + Enter Edit and view resources
Alt + Home The navigation bar F11 bookmark switch is displayed
Ctrl + Shift + F11 Bookmark mnemonic switch
Ctrl + #[0-9] Jump to the marked bookmark
Shift + F11 Show bookmarks

Resource portal

  • Concern [do a gentle program ape] public number
  • In the [do a gentle program ape] public number back [Python data] [2020 fall recruit] can get the corresponding surprise!

“❤️ thank you all”

  • Like support, let more people can also see this content.
  • Share your thoughts with me in the comments section, and record your thought process in the comments section.