Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the most useful shortcuts for pycharm

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the practical pycharm commonly used shortcut keys have what related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe you read this practical pycharm common shortcut keys which articles will have a harvest, let's take a look at it.

1. Comments (add / remove) (Ctrl + /)

Here we say that the single-line comment for Python is #, the multi-line comment is' comment content'', the single-line comment for java is / /, the multi-line comment / * comment content * /, the document comment / * * comment content * /

The comment shortcuts here are mainly used for multi-line comments. When you want to temporarily comment out a piece of code, you can directly select the code, use this shortcut key, and use the same operation when you want to restore it.

two。 Code shift right / left (Tab / Shift + Tab)

Python code indentation is very strict, will directly lead to syntax errors, normal indentation is 4 spaces (that is, a tab key), in order to unify the convenience and not easy to make mistakes, it is best to use the tab key for indentation.

3. Automatic indentation (Ctrl + alt + I)

If there is a problem with indentation in your code, but it is not easy to see where the problem is, you can use this shortcut to automatically indent to correct the error directly, or you can use the quick fix below.

4.PEP8 specification formatting (Ctrl + alt + L)

The current Python syntax format specification follows the PEP8 specification, and sometimes the format problem may not lead to syntax errors, but for the sake of cleanliness and readability of the code, it is best to use the next shortcut to quickly standardize the code. When you knock on the code, you can force yourself to follow the specifications and develop good code writing habits.

5. Quick fix (alt + enter and then enter)

This function can quickly correct some syntax errors in your code. After using the shortcut keys, suggestions for correction will be displayed. Generally speaking, you can press enter to automatically correct them.

6. Copy one line / multiple lines / selected section (Ctrl + D)

Ordinary copy needs to select copy content, and then copy and paste, more troublesome, with this shortcut, you can directly copy one line or selected multiple lines, or very convenient. Note that in eclipse, this shortcut key is to delete a line, don't get it mixed up.

7. Delete one / multiple rows (Ctrl + Y)

This corresponds to the copy above, directly delete a whole line, do not need to delete one by one, this shortcut key also pay attention, because in the system this is an anti-undo shortcut key.

8. Global search (Ctrl + shift + F)

General search Ctrl+F, not to mention the general system, the global search here can be found in the entire project, not just the current file.

9. Global replacement (Ctrl + shift + R)

This corresponds to the global search.

10. Move the cursor to the next line (shift + Enter)

Normally, only pressing enter at the end of the cursor will change to the next line. If it is in the middle, the following code will be moved to the next line together. This shortcut key allows the cursor in the middle to move directly to the next line without affecting the following code.

11. Undo / reverse undo (Ctrl + Z / Ctrl + shift + Z)

This is also a common function, just pay attention to the difference between anti-undo and system (Ctrl + Y).

twelve。 Copy the parent code (Ctrl + o)

Most of the time, I will copy the code of the parent class, but if I type the relevant code of the parent class directly, there may be spelling mistakes. Use this shortcut to ensure that there will be no spelling mistakes.

13. Select word / code block (Ctrl + W)

This method to select words / code blocks does not need to be selected with a little bit of mouse, it is more convenient. Note that the shortcut keys for closing the current tab are also commonly used in QQ Browser.

14. Quick View of documentation (Code Information) (Ctrl + Q)

When you don't know about a method / function / class, you can quickly view the relevant documentation information.

15. Insert a row down anywhere (shift + enter)

This and the cursor to move to the next line is the same shortcut, in fact, only a slight change in the application scene, the following code is to insert a line, no code is naturally just move the cursor.

16. Insert a row up anywhere (Ctrl + alt + enter)

This is the opposite of the above operation. The same thing is that it can be operated anywhere, regardless of the position of the cursor.

17. View project view (alt + 1)

The project view shows the file structure of the entire project. It is also the default view.

18. View structural view (alt + 7)

The structure view shows a variety of specific structures in the project: classes, methods, variables and other specific information, but also a very useful view.

19. Quick access to the code (Ctrl + left)

In the case of calling a method, if you want to know the details of the method, you can enter the inside of the method directly with this method.

20. Quick View History (alt + left (back) / right (forward))

This is similar to the function of system shortcuts, and it is convenient to review previous operations.

21. Quick view of different methods (alt + up / down)

This method can jump directly from one method to another, which is very convenient for viewing code.

twenty-two。 Switch views (Ctrl + Tab)

This view switch is the same as in QQ Browser, probably except for the system view switch, most of the other software switch views are this shortcut key.

23. View resource files (shift twice)

This method can quickly view the details of the resource files you have introduced.

24. See where the method is called (Ctrl + alt + H double-click to determine the location)

This method can quickly find the location where the method is called and is useful for understanding the structure of the code.

25. View parent class (Ctrl + U)

twenty-six。 View inheritance relationships (Ctrl + H)

This is the end of the article on "what are the common shortcut keys for pycharm?" Thank you for reading! I believe you all have a certain understanding of the knowledge of "what are the common shortcuts for practical pycharm". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report