IDE-pycharm—set the python script file header of the file template

In daily development, the general file header comments of python script code files can solve the problem of specifying which interpreter to use for script execution. Python defaults to ASCII encoding. If it contains Chinese, in order to prevent garbled characters, it is often necessary to redeclare the encoding type at the beginning of the encoding. In addition, you can customize other description information of other files. Settings: File->settings > Editor > File and Code Templates > Python Script > Apply / OK

Example of edited content:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 创建时间:${DATE} ${TIME}
# 文件名:${NAME}.py
# 作者:北冥有鱼(贾宝瑞)

Guess you like

Origin blog.csdn.net/JBY2020/article/details/128470789