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 tips of PyCharm?

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

Share

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

What are the tips of PyCharm? in view of this question, this article introduces in detail the corresponding analysis and solutions, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

PyCharm tips to help you improve your work efficiency!

# 0. Common shortcut keys for PyCharm

# 1. View the source code of using the library

Often hear people say, look more at the source code. The source code can not only help us figure out how it works, but also learn the best practices of good libraries or frameworks.

When calling the library, you can click Command+B almost anywhere you are curious, and you can easily jump to the definition of classes, methods, functions, and variables in the source code.

# 2. Let your code PEP8

Do you strictly follow the pep8 specification when writing Python code? You still have to abide by it, otherwise it will not be good for the code to be transferred to github or Zhihu. But if you rely on the naked eye to check and pay attention, you are too tired, just rely on PyCharm to do this, Command+Option+L, press pep8 to go.

# 3. Novices no longer worry about the installation library

If you are a novice and may have trouble installing libraries, you can use your familiar graphical interface to install libraries in PyCharm without getting stuck in a bunch of command lines.

# 4. Find files, classes, methods

When we need to find a file name in the project, type Command + Shift + O, and then enter the file name you want to find. If you don't remember your full name, just type your initials and Pycharm will prompt you. For example, if I want to find a file called test_errors.py, I just need to type tee to find it. Or query test_errors_1.py so you only need to type tee1 to find it.

# 5. Quickly select code blocks

How do you quickly annotate a block of Python code? It's not going to be line by line plus #.

When you need to select a function, just put the cursor at the front, and then click Command + Option + Shift + [, you can choose to use Command + / comment on the current code block.

# 6. Quickly insert common code

Sometimes you need to enter a very long code, such as if _ _ name__ = = _ _ main__:. In this case, manual input is not as good as direct Command + J, and you can insert common code directly.

# 7. Run / debug code

Running and debugging code should be the most commonly used shortcut keys for most people.

Mac:

Control + r: run the current code directly

Control + d: run code in Debug (debug) mode

Windows/Linux:

Shift + F10: run the current code directly

Shift + F9: run code in Debug (debug) mode

# 8. Indent your code block

When writing front-end pages, you often have to change the indentation of a large piece of code, so you can first use Shift + arrow keys to select the block of code you want to indent, and then use Tab to indent it.

# 9. Expand / shrink code

When the project is written to a certain scale, it is inevitable that there will be a lot of methods / functions. At this time, we can use the Command + Shift +-symbol to shrink the code, which is mainly for easy viewing.

# 10. Show multiple pages

When your company is unwilling to configure two screens for you, you can still use PyCharm to view multiple files on one screen. Mouse over the file name at the current navigation, and then right-click Split Vertically or Split Horizontally.

The answers to the questions about PyCharm tips are shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

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