SoFunction
Updated on 2024-10-29

Method to automatically set the header template information in Pycharm when creating a new file

preamble

pycharm default is not for us to set the template information, but in order to more easily realize the code management, as well as to be able to see at a glance to when we wrote the code, I personally feel that adding a template information is still very necessary.

Implementation methodology

Click File | Settings | Editor | File and Code Templates, then select python Script, and fill in the information of the template you want to design in the input box on the right.Here is an example of a graphic

在这里插入图片描述
在这里插入图片描述

Editorial content

There are a number of template messages set up in pycharm that can be written as needed

$ {YEAR} # That year
$ {MONTH} # of the month
$ {DAY} # The day
$ {HOUR} # Current hour
$ {MINUTE} # Current minute
$ {SECOND} # Current seconds
$ {PROJECT_NAME} # Current project name
$ {NAME} # Current filename
${PRODUCT_NAME} # Current IDE
$ {USER} # Login name of the current user
$ {DATE} # Current system date
$ {TIME} # Current system time
$ {MONTH_NAME_SHORT}# First three letters of the name of the month
$ {MONTH_NAME_FULL}# Full name for one month

Effect display

After writing the header message template in the python script, let's create a new python file to see the effect

在这里插入图片描述

to this article on the new file Pycharm automatically set the header template information is introduced to this article, more relevant Pycharm automatically set the template information content please search for my previous posts or continue to browse the following related articles I hope you will support me more in the future!