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

Sharing practical skills of PyCharm

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article introduces the relevant knowledge of "PyCharm's Practical Skills Sharing". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

0. PyCharm Common Shortcuts Click to enlarge

img

img1. imgPyCharm main programmer replied on Stackoverflow often listen to people say, look at the source code. The source code not only helps us figure out how to run it, but also learns best practices from good libraries or frameworks. When calling libraries, you can click Command+B almost anywhere you are curious, and it is easy to jump to the definition of classes, methods, functions, and variables in the source code. The operation is as follows: 2. When writing Python code with PEP8, will you strictly follow the PEP8 specification? It is still necessary to abide by it, otherwise the code will not be good if it is transmitted to github or if it is known. But if you rely on the naked eye to check and pay attention, it is too tired. It is good to rely on PyCharm to do this. Command+Option+L, one key pep8 to walk. 3. No more worries about installing libraries for beginners

If you're new to this, you might be bothered by installing libraries, but PyCharm lets you install them using the familiar graphical interface instead of getting stuck on the command line. The operation is as follows:

4. Find files, classes, methods When we need to find a file name in the project, type Command + Shift + O, and then type the file name you want to find. If you don't remember the full name, just type in 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 you can query test_errors_1.py and just type tee1 to find it. 5. How would you quickly comment a Python code block? It's not a line by line #... When you need to select a function, just put the cursor in the front and click Command + Option + Shift + [to select Command + /Comment for the current code block. 6. Quick insertion of common code img Sometimes you need to enter a long code, such as if name__ == '__main':, at this time manual input is not as good as direct Command + J, you can directly insert common code. 7. Running/debugging code Running code and debugging code should be the most commonly used shortcut keys for most people. Mac: Control + r: Run current code directly Control + d: Run code in Debug mode Windows/Linux: Shift + F10: Run current code directly Shift + F9: Run code in Debug mode 8. Indent your code block When writing the front page, you often have to change the indentation of a large section of code. At this time, you can use Shift + up and down keys to select the code block 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 many methods/functions. At this time, we can use Command + Shift + -symbol to shrink the code. This is mainly for convenience. 10. When your company doesn't want to configure you with two screens, you can still use PyCharm to view multiple files on one screen. Mouse over the file name in the current navigation and right click Split Vertically or Split Horizontally. "PyCharm practical skills sharing" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

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

Internet Technology

Wechat

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

12
Report