当前位置:网站首页>Super double efficiency! Pycharm ten tips

Super double efficiency! Pycharm ten tips

2022-06-26 15:39:00 Panda aiqia rice

Preface

Big guys, good duck ~ I am a panda. Today I want to show you python Ten tips for ~
Don't talk much Let's start

 Insert picture description here

do person : Liu shanguo
Diffuse draw : Cat Xiaoguang
Come on Source : Muggle programming (easypython)

0. PyCharm Common shortcut key

 Please add a picture description
 Please add a picture description

1. Check the source code of the library Click here to get the information

 Please add a picture description
Listen to people often , Look at the source code . Source code can not only help us understand the operation mechanism , You can also learn good library or framework best practices .

When calling the library , You can click... Almost anywhere you are curious Command+B, It is very convenient to jump to the class in the source code , Method , function , Definition of variables .

2. Let your code PEP8 Click here to get the information

 Please add a picture description
Write Python Code , You will strictly abide by pep8 Norm ? Still have to abide by , Otherwise, the code will be sent to github Or to know that it's not good to be hated . But if you rely on the naked eye to check and pay attention , Too tired , by PyCharm Just do it ,Command+Option+L, Onekey pep8 Walk up .

3. Novices no longer worry about installing Libraries Click here to get the information

 Please add a picture description
If you're new , You may have trouble installing the library , stay PyCharm You can use the familiar graphical interface to install the library , You don't have to get stuck in a bunch of command lines .

4. Find files 、 class 、 Method Click here to get the information

When we need to find a filename in the project , Input Command + Shift + O, Then enter the name of the file you want to find . If you don't remember the full name , Just type the first letter ,Pycharm It will remind you . For example, I want to find a name test_errors.py The file of , So just type tee You can find it . Or search test_errors_1.py So just type tee1 You can find .

5. Quick selection of code blocks Click here to get the information

How can you quickly comment on a paragraph Python Code block ? It's not going to be line by line # Well ……

When you need to select a function , Just put the cursor at the front , And then click Command + Option + Shift + [ , You can choose the current code block , Use Command + / notes .

6. Insert common code quickly (https://jq.qq.com/?_wv=1027&k=2OpBRkgk)

 Please add a picture description
Sometimes you need to enter a long code , such as if name == ‘main’: , In this case, manual input is better than direct input Command + J , You can insert common code directly .

7. function / Debugging code Click here to get the information

Run code 、 Debugging code should be the most commonly used shortcut for most people .

Mac:

Control + r: Run the current code directly
Control + d: With Debug( debugging ) Mode run code

Windows/Linux:

Shift + F10: Run the current code directly
Shift + F9: With Debug( debugging ) Mode run code

8. Indent your code block

When writing the front page , Always change the indent of a large piece of code , You can use it first Shift + Up and down keys To select the code block you want to indent , And then use Tab You can indent .

9. an / Shrink code

When the project is written to a certain scale , It's hard to avoid / There will be many functions , We can use it at this time Command + Shift + - Symbol To shrink the code , This is mainly for convenience .

10. Show multiple pages

 Please add a picture description
When your company is not willing to configure for you 2 When there's a screen , You can still use PyCharm View multiple files in one screen . Mouse over the filename of the current navigation , And then right-click Split Vertically perhaps Split Horizontally That's all right. .

So this is the end of today's sharing At the end of the article, you can get free materials on demand
I'm a panda , See you in the next article ~
 Insert picture description here

原网站

版权声明
本文为[Panda aiqia rice]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206261516116856.html