Pycharm tips for using: Live Templates (quickly enter custom code snippets) __snippet

Source: Internet
Author: User
Live Templates:

Pycharm's live templates implement the ability to enter specified characters to expand into custom code snippets, improving productivity. Let's take the default main expansion for example, see the figure below, main then press ENTER to automatically expand to:

if __name__ = = ' __main__ ':


to view the system's own code extensions: file-"setting-" editor-"Live templates-" Python Python's own code snippet expansion includes Main,super, and so on, click on an item in the lower template text area can see the expanded content.


define your own code fragment: Here we take the input encode to expand to #-*-Coding:utf-8-*-for example.

From file-"setting-" editor-"Live templates-" python into the code snippet editing interface,

Steps:

1. Click on the Green Plus icon on the top right to select 1. Live Templates;

2. In Addreviation input encode, enter prompt statement in decscription: Expand to #-*-Coding:utf-8-*-

3. In template text Input #-*-Coding:utf-8-*-

4. Click Define, Tick Python

5. Click OK button to take effect.





Next we test the effect of encode expansion.

Enter encode press ENTER.

PS: The Green Box content is entered in description in step 2.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.