PyCharm custom file and code template,
PyCharm provides file and code template functions. You can use this template to quickly create code or files. For example, to create an html file in PyCharm, the new file is not empty, but will automatically fill in some basic necessary content, just like this:
<!DOCTYPE html>
The template content that comes with the system may not be desired. You can modify and add personalized content. For example, if I create a Python file named main. py, the content will be automatically filled in:
# -*- coding: utf-8 -*-"""------------------------------------------------- File Name: main.py Description : Author : JHao date: 2017/4/1------------------------------------------------- Change Activity: 2017/4/1:-------------------------------------------------"""__author__ = 'JHao'
The File Name is the File Name, and Author is the username used to log on to the system. The date is the current system date. Does it feel much better than the default blank file. The specific modification steps are as follows: [File] → [Settings], in [Editor) ], find File and Code Templates, and select the File type you want to edit.
My template is like this:
# -*- coding: utf-8 -*-"""------------------------------------------------- File Name: ${NAME} Description : Author : ${USER} date: ${DATE}------------------------------------------------- Change Activity: ${DATE}:-------------------------------------------------"""__author__ = '${USER}'
Attached template variables:
$ {PROJECT_NAME}-NAME of the current Project; $ {NAME}-NAME of the file specified in the create file dialog box; $ {USER}-current user name; $ {DATE}-current system DATE; $ {TIME}-current system TIME; $ {YEAR}-YEAR; $ {MONTH}-MONTH; $ {DAY}-DAY; $ {HOUR}-HOUR; $ {MINUTE}-MINUTE; $ {PRODUCT_NAME}-name of the IDE for creating a file; $ {MONTH_NAME_SHORT}-abbreviated month, for example, Jan, Feb, etc; $ {MONTH_NAME_FULL}-Full name of the English month, for example, January, February, etc;