Pycharm's new template adds author time and other information by default

In the process of using pycharm, it is more convenient to use templates to quickly fill in the shebang line of each new file and some personal information about the code writer.

  Methods as below:

  1. Open pycharm and select File-Settings

 

  2.选择Editor--Color&Style--File and Templates--Python-Script

3. Edit content

(a)shebang行

#!/usr/bin/python3

(b) Predefined variables are to be expanded to corresponding values ​​in the format ${<variable_name>}.

The available predefined file template variables are:

${PROJECT_NAME} - The name of the current project.

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

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

${DATE} - The current system date.

${TIME} - Current system time.

${YEAR} - This year.

${MONTH} - The current month.

${DAY} - The day of the month.

${HOUR} - The current hour.

${MINUTE} - the current minute.

${PRODUCT_NAME} - The name of the IDE where the file will be created.

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

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

 

example

copy code
##!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time    : ${DATE} ${TIME}
# @Author : Mr Han
# @Email   : [email protected]
# @File    : ${NAME}.py
# @Software: ${PRODUCT_NAME}
copy code

The result is as follows:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325382306&siteId=291194637