In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "what are the default code snippets in Pycharm", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let me lead you to study and learn what are the default code snippets in Pycharm.
There are already some code snippets by default in Pycharm, as follows:
Menu "File"-> Settings, enter the settings interface
Click "Editor"-> "Live Templates" on the left to enter the real-time template interface.
Click on the Python bar and you can see many default code snippets
Let's look at how to use code snippets to implement a small example. Use deduction to filter some values from a list. Look at the moving picture below.
I didn't use a mouse the whole time.
When I finish the first line, how do I go straight to the second line? Press shift+enter, and you can.
Through the code snippet "compgi", you can generate a deductive code snippet. Press the tab key to jump in different areas.
Note that Pycharm also allows you to choose which sequence variable to use when the code snippet is generated.
Sometimes we need custom code snippets. Look at the following picture:
Menu "File"-> Settings, enter the settings interface
Click "Editor"-> "Live Templates" on the left to enter the real-time template interface.
In the template content, use the $variable $to define replaceable places in the template.
On the right button "Edit variables", you can enter the variable settings, you can set the details of each template variable, such as the default value, for example, you can set the variable for the user to choose.
After setting up, click "OK" and you can use it. See how it works.
Using type hints, get a smart hint for variable types
Many times when we define a method, we will find that we can't get any useful intelligence when using a parameter in the method. This is because the variable definition of Python does not need to indicate the type, so IDE cannot speculate what type it is. The figure below is as follows
We can get smart tips by tag type, and the latest version of Pycharm is fully supported. As follows
You can label the type as long as you add: variable type after the parameter.
You can see that the parameter df can now get the correct type of IntelliSense.
Pycharm has a modification prompt function, which can simplify some operations.
The example here is the parameter in the method, but it is also feasible for variables, so I won't give an example here.
These are all the contents of the article "what are the default code snippets in Pycharm?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.