Pycharm设置代码模板

设置路径:

file -> setting -> editor -> file and code templates

模板变量如下:

${PROJECT_NAME} - 当前Project名称;
${NAME} - 在创建文件的对话框中指定的文件名;
${USER} - 当前用户名;
${DATE} - 当前系统日期;
${TIME} - 当前系统时间;
${YEAR} - 年;
${MONTH} - 月;
${DAY} - 日;
${HOUR} - 小时;
${MINUTE} - 分钟;
${PRODUCT_NAME} - 创建文件的IDE名称;
${MONTH_NAME_SHORT} - 英文月份缩写, 如: Jan, Feb, etc;
${MONTH_NAME_FULL} - 英文月份全称, 如: January, February, etc;

模板示例

# -*- coding:utf-8 -*-
"""
__project_ = '$PROJECT_NAME' __file_name__ = '$NAME' __author__ = '$USER' __time__ = '$DATE $TIME' __product_name = ${PRODUCT_NAME} # code is far away from bugs with the god animal protecting I love animals. They taste delicious. ┏┓ ┏┓ ┏┛┻━━━┛┻┓ ┃ ┃ ┃ ┳┛ ┗┳ ┃ ┃ ┻ ┃ ┗━┓ ┏━┛ ┃ ┗━━━┓ ┃ 神兽保佑 ┣┓ ┃ 永无BUG! ┏┛ ┗┓┓┏━┳┓┏┛ ┃┫┫ ┃┫┫ ┗┻┛ ┗┻┛ """

if __name__ == '__main__':
pass


 

posted @ 2020-03-01 16:32  ReluStarry  阅读(231)  评论(0编辑  收藏  举报