当前位置:网站首页>How fragrant! The most complete list of common shortcut keys for pychar!
How fragrant! The most complete list of common shortcut keys for pychar!
2022-06-28 13:33:00 【Xinyi 2002】
↓ Recommended attention ↓
If a worker wants to do a good job, he must sharpen his tools first , Today we share Pycharm Common shortcut keys for , When you write code, you get twice the result with half the effort !

1. Format generation code 【Ctrl + Alt + L】
When we wrote the code, we found a lot of yellow wave marks , Similar to
At this time, you can click any yellow tilde code , Then press 【Ctrl + Alt + L】 Format the code 
Formatting effect
def x():
a = 1
b = [1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 123, 12, 31, 231, 23, 123, 1, 231, 23, 123, 1, 43, 53, 643, 53, 4, 24, 12, 31,
231, 23, 123, 24, 53, 4534, 2, 1231, 23, 1]
print(a)
x()2. Many lines of code Merge into one line 【Crtl+Shift+J】
If you want to merge the following code into one line , You can select all of them , Then press 【Crtl+Shift+J】 You can merge the code into one line , It will also automatically supplement the code
x=1
y=1
z=1The combined effect
x=1; y=1; z=13. Correct the alarm The code of the report 【Ctrl + Enter】
When the Yellow tilde appears , You can press... In the corresponding code 【Ctrl + Enter】 Correct the code 
Press after , There are many options for you to correct , Include : formatting code , Ignore this warning , Automatically modify code, etc

For example, choose :【invert ‘if’ condition】 It will be automatically changed to the following code :
def test(x):
if 1 != 1:
return
pass4 . Packaging agent code 【Crtl+Alt+T】
We can quickly add... To the input code if、while、 Catch exceptions and other conditions
For example, there is the following code
x=1 We select the code and press 【Crtl+Alt+T】 The window will pop up and let us choose the conditions to be packed , Now we choose 【try/except】
Packaging effect
try:
x=1
except:
pass5. Quick annotation / uncomment 【Crtl+/】
If we want to annotate part of the code, we can select the corresponding code , And press 【Crtl+/】
def show_text(text,a):
a+=1
print(text,a)Annotate the results
# def show_text(text,a):
# a+=1
# print(text,a)Press again 【Crtl+/】 Uncomment
6. towards the right Indent a tab stop 【Tab】
python The indentation requirements for code are very strict , The following code will report an error !
def test():
y = 1
y += 1
print(y)But it's hard to adjust indentation line by line , Efficiency is very low ! At this time, you can select the code that needs to be indented , Press down 【Tab】 that will do
effect
def test():
y = 1
y += 1
print(y)7. Zoom left Enter a tab stop 【Shift + Tab】
ditto
8. On top Insert new line 【Ctrl + Alt + Enter】
If you want to code below a+=1 If you insert a blank line above , You can click to a+=1 This line , Then press 【Ctrl + Alt + Enter】, A new line will be inserted above it
def show_text(text,a):
a+=1
print(text,a)effect
def show_text(text,a):
a+=1
print(text,a)9. Insert new... Below That's ok 【Shift + Enter】
ditto
10. Up and down Move the selected code 【Alt + Shift + On 、 Down key 】
If we want to put the following code a=1 Move to print('click') upper , Can be in a=1 Press 【Alt + Shift + On 】 Move it
def click(path):
print('click')
a = 1effect
def click(path):
a = 1
print('click')Press... When moving down 【Alt + Shift + Next 】 that will do !
11. Move the selected party up and down Dharma body 【Ctrl + Shift + On 、 Down key 】
If we want to put the following send Method to move to click Above the method , Can be in send Method name line (def Place of action ) Press down 【Ctrl + Shift + On 】 that will do
def click(path):
print('click')
def send(path):
print('send')effect
def send(path):
print('send')
def click(path):
print('click')Press... When moving down 【Ctrl + Shift + Next 】 that will do !
12. Copy code 【Ctrl + D】
If we want to copy a line of code , You can press... On the corresponding line of code 【Ctrl + D】
x=y=z=1effect
x=y=z=1
x=y=z=1You can also select multiple lines of code to copy
def show_text(text,a):
a+=1
print(text,a)effect
But I need to change my career
def show_text(text,a):
a+=1
print(text,a)def show_text(text,a):
a+=1
print(text,a)13. Collapse code 【Ctrl + -】
If you want to collapse the following code , You can select the code and press 【Ctrl + -】
def show_text(text,a):
a+=1
print(text,a)effect
def show_text(text,a):...14. Expand code 【Ctrl + +】
ditto
15. Extract the code into a method 【Ctrl + Shift+M】
If you want to add the following code , Write in a method , You can select the code and press 【Ctrl + Shift+M】
y=1
y+=1
print(y)Then rename the method , Click again 【ok】

effect
def test():
global y
y = 1
y += 1
print(y)
test()16. rename file 【Shift+F6】
When you need to rename a file name , You can select the corresponding file and press 【Shift+F6】, Enter a new file name in the input box, and then click 【Refactor】 that will do 
effect 
17. The search class is Where to quote 【Ctrl+N】
Press down 【Ctrl+N】 Enter the keyword of the class , You can see the referenced class , Click the corresponding entry to jump to the corresponding file 
18. check look for / Global search 【Ctrl+F / Ctrl + Shift+F】
To find the current file, press 【Ctrl+F 】 And enter the keyword you want to find, and the code containing the keyword will be highlighted

Click the red arrow in the figure , You can view the code containing keywords line by line ; in addition , Press down 【Shift + F3】 or 【F3】 It can also be realized !

Click the window icon in the red box , Can open TOOL Window for multi window query 
effect 
For global query, press 【Ctrl + Shift+F】 that will do !
19. Replace / Global replacement 【Ctrl+R / Ctrl + Shift+R】
To replace the current file, press 【Ctrl+R 】 And enter the keyword to be replaced in the first column, and the code containing the keyword will be highlighted , In the second column, enter the keyword to be replaced with , Press down 【replace】 or 【replace All】( Replace all )
effect
In the red box below 【exclude】 If you click , The selected code will be excluded , Just replace other code 
effect

For global replacement, press 【Ctrl + Shift+R】 that will do !
20. Fast jump to the error reporting code 【F2】
When a code error occurs , Can be pressed F2 Quickly jump to the error code 
effect 
21. Define a bookmark 【F11】
Press... At the corresponding code 【F11】 You can define it as a bookmark 
Then press the 【Shift+F11】, You can view the code corresponding to the bookmark 
22. Code lowercase to uppercase 【Ctrl + Shift+U】
If you want to capitalize the following code , You can select the code and press 【Ctrl + Shift+U】
product_nama_dict={}effect
PRODUCT_NAMA_DICT={}23. Enter a method 【Ctrl + B / Ctrl + Left mouse button 】
If you want to enter time Module method , You can choose 【time】 Then press the 【Ctrl + B 】, Or press 【ctrl+ Left mouse button 】
effect 
24. Implementation of quick view method ( Source code )【Ctrl + Shift + I】
If we want to see 【time】 How is it realized , You can select and press 【Ctrl + Shift + I】
import time
time.sleep() effect 
25. View the document description 【Ctrl + Q】
If we want to see 【time】 Documents , You can select and press 【Ctrl + Q】
import time
time.sleep() effect 
26. View the methods in the file 【Ctrl + F12】
Press down 【Ctrl + F12】 You can see what methods are in this file 、 class
27. List of recently edited files 【Ctrl + E】

28. Run code quickly 【Shift + F10】
Run the current file code quickly
29. Quick debug code 【Shift + F9】
Quickly debug the current file code
30. Quick switch view / Catalog 【Ctrl + Tab】

31. View recent changes 【Alt + Shift + C】
32. Move the cursor to the end of the line 【End】
When your code is very long , It's beyond the screen !
Can be pressed 【End】( Notebooks are generally 【Fn+End】) You can jump to the end of the line

effect
Press down 【Home】( Notebooks are generally 【Fn+Home】) But go back to the beginning of the line !
33. Select all lines and move to the end of the line 【Shift + End】
effect 
34. View history paste copy record 【Ctrl + Shift+ V】
Press down 【Ctrl + Shift+ V】 You can view the copy and paste history 
Select any line to restore it back
@api_view(['PATCH'])
@permission_classes((IsAuthenticated,))
def set_client_debug(request):
Client.objects.filter(user_id=request.user.id).update(debug=request.data['debug'])
return Response(data={'code': 0})35. Move the cursor to the beginning of the method body or loop 【Ctrl + {】
When your method or loop is very long , Can be pressed 【Ctrl + {】 Go back to the function or loop header
36. Move the cursor to the end of the method body or loop 【Ctrl + }】
When your method or loop is very long , Can be pressed 【Ctrl + }】 Back to the end of a function or loop
37. Maximize the edit code window 【Ctrl + Shift + F12】
When we open multiple windows , When it affects the code editing experience , As shown in the figure below , Can be pressed 【Ctrl + Shift + F12】 Hide other windows 
effect 
38. Quick add code 【Ctrl + J】
Press down 【Ctrl + J】 You can quickly add code 
Such as adding if __name__ == __main__, Click on the 【main】 that will do :
if __name__ == '__main__':
Well, that's all we have to share today , Just order one if you like Fabulous Well ~

Recommended reading Share 、 Collection 、 give the thumbs-up 、 I'm looking at the arrangement ?




边栏推荐
- 哈希竞猜游戏系统开发技术成熟案例及源码
- 简历模板百度网盘自取
- CodeBlocks MinGW installation configuration problem
- 弹性盒子自动换行小Demo
- Complete backpack beginner chapter "suggestions collection"
- Embedded design and development project - liquid level detection and alarm system
- 公司领导说,个人代码超10个Bug就开除,是什么体验?
- Resume template Baidu online disk
- thinkphp6 多级控制器目录访问解决方法
- flex布局中的align-content属性
猜你喜欢

Mobile web training day-2

The press conference of Tencent cloud Database & CSDN engineer's ability lightweight certification is coming

FS7022方案系列FS4059A双节两节锂电池串联充电IC和保护IC

Vscode如何设置代码保存后自动格式化

Arduino-ESP32闪存文件插件程序搭建和上传

PHP抓取网页获取特定信息

Unit test ci/cd

2. 01背包问题

Google Earth Engine(GEE)——联合国粮农组织全球有机土壤面积(1992-2018年度)

移动Web实训DAY-2
随机推荐
matlab plotyy 坐标轴设置,[转载]Matlab plotyy画双纵坐标图实例[通俗易懂]
电子元器件分销10亿俱乐部[通俗易懂]
En parlant d'exception - que se passe - t - il lorsque l'exception est lancée?
Electronic components distribution 1billion Club [easy to understand]
VSCode 快捷键
In the past four years, the number of users exceeded 100 million, and sun Ge led the wave field to a new high
Stm32f1 and stm32cubeide programming example - matrix keyboard driver
Commonly used "redmine" for # test bug
Hematemesis recommends 17 "wheels" to improve development efficiency
Resume template Baidu online disk
简历模板百度网盘自取
Unit test ci/cd
Vscode如何设置自动保存代码
Stackoverflow 2022 database annual survey
Rk3399 platform development series explanation (use part) pinctrl subsystem introduction - Video Introduction
决策树预测红酒品质
中国数据库技术大会(DTCC)特邀科蓝SUNDB数据库专家精彩分享
Vscode如何设置代码保存后自动格式化
Forecast and Analysis on market scale and development trend of China's operation and maintenance security products in 2022
求职简历的书写技巧