Automatically add file header, time, date and other information in PyCharm
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: