Writing Python code used to feel inefficient because of the constant scrolling and formatting. This distraction interrupts the train of thought, and it takes a long time to pick it up again…


However, after I learned the following PyCharm techniques, I became more efficient and started to feel the code (help me up and I can still write code)). All the tips I used in PyCharm are very common and useful, and I would like to share them with you.


. .


1. Common shortcut keys

* Code segment indentation

– Shift + Tab Indents the content position

– Tab Indents the content position

* Batch notes

                – Ctrl + /

* Check the source code

                – Ctrl + B

Code formatting (comply with the PEP8 format specification)

                – Ctrl + Alt + L

* Find and replace

                – Ctrl + R


2. Restore the mistakenly deleted files

* Right-click project directory -> Local History ->

Show History -> Show History -> Show History ->

Right-click -> Revert to restore


3. Turn off those annoying wavy lines

* Click on the head in the lower right corner to set the level to Syntax level


. .


Here’s why I find these shortcuts so useful.


Code formatting: Sometimes I don’t pay much attention to the format when I write the code, resulting in the code looks very messy and the readability is very poor. At this time, I only need to use the shortcut key of code formatting to adjust the code to PEP8 format with one key. Again, what is PEP8? The PEP8 format is a Python coding standard. It is recommended by Python to write code in this format.


Turn off annoying wavy lines: Every time I write code, I get a bunch of wavy lines on the screen, as if my code is buggy, but there is no bug, it’s just that PyCharm’s automatic checking level is too high. For example, I defined a variable xiaohong, which was fine, but PyCharm detected that the variable was not a correct English word (I used Chinese pinyin ah Hello), and the wavy lines suggested that there might be some error, which made the whole screen very messy and uncomfortable to look at.



If you want to open the door to the new world, you can scan the QR code below and follow the wechat public account “SuperFeng”.