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

Automatically add file header, time, date and other information in PyCharm

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

When you install PyCharm for the first time, you will find that there is no information in the header when you create a new .py file, so it is convenient to use templates.

The methods are as follows:

Open PyCharm and select File--Settings

Select Editor---Code Style-- File and Code Templates---Python Script in turn

Edit content

You can add the corresponding information as needed

#! / usr/bin/python3

The available predefined file template variables are:

${PROJECT_NAME}-name of the current project.

${NAME}-the name of the new file specified in the New File dialog box during file creation.

${USER}-the login name of the current user.

${DATE}-the current system date.

${TIME}-current system time.

${YEAR}-this year.

${MONTH}-current month.

${DAY}-the day of the month.

${HOUR}-current hour.

${MINUTE}-current minute.

${PRODUCT_NAME}-the name of the IDE in which the file will be created.

${MONTH_NAME_SHORT}-the first three letters of the month name. Example: January, February, etc.

${MONTH_NAME_FULL}-the full name of the month. Example: January, February, etc.

For example:

The display is as follows:

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