Pycharm Template¶
Python 模板的作用是在创建新文件的时候就自动拥有该模板中的内容。甚至模板还可以带有变量。
重要参考: File template variables
使用方法¶
打开 Settings;
搜索 Templates,找到 File and Code Templates -> Python Scripts
将模板中的内容复制进去
Pycharm 模板¶
在制作模板时,最重要的是特点是可以使用变量。
# -*- coding: utf-8 -*-
"""
# @Title : Key word
# @Project : ${PROJECT_NAME}
# @Time : ${DATE}
"""
def print_hi():
print("hi")
if __name__ == '__main__':
print_hi()
Details in python_templates.py
和 Notetool 兼容的 Pycharm Python 模板¶
2023-07-25
# -*- coding: utf-8 -*-
"""
#Title: pycharm python source file template
#fid: ${YEAR}${MONTH}${DAY}-${HOUR}${MINUTE}${SECOND}
#update: ${DATE}
#notebook: ${PROJECT_NAME}
"""
def print_hi():
print("hi")
if __name__ == '__main__':
print_hi()