本文主要介绍PyCharm中文件template设置。
打开PyCharm设置界面,搜索template
,选择File and Code Templates
--Python Script
,如下图所示,输入自定义模板即可。
模板内容:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: txfly
@contact:***@**.com
@version: 1.0.0
@license: Apache Licence
@file: ${NAME}.py
@time: ${DATE} ${TIME}
"""
其中预定义的模板变量有:
Variable | Description |
---|---|
${DATE} | Current system date |
${DAY} | Current day of the month |
${DS} | Dollar sign $ . This variable is used to escape the dollar character, so that it is not treated as a prefix of a template variable. |
${FILE_NAME} | Name of the new file. |
${HOUR} | Current hour |
${MINUTE} | Current minute |
${MONTH} | Current month |
${MONTH_NAME_FULL} | Full name of the current month (January, February, and so on) |
${MONTH_NAME_SHORT} | First three letters of the current month name (Jan, Feb, and so on) |
${NAME} | Name of the new entity (file, class, interface, and so on) |
${ORGANIZATION_NAME} | Name of your organization specified in the project settings (Ctrl+Shift+Alt+S) |
${PRODUCT_NAME} | Name of the IDE (for example, PyCharm) |
${PROJECT_NAME} | Name of the current project |
${TIME} | Current system time |
${USER} | Login name of the current user |
${YEAR} | Current year |
也可以通过#set
定义自定义变量,详情参考http://www.jetbrains.com/help/pycharm/file-template-variables.html
版权声明:本文为「txfly」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://www.jianshu.com/p/23fea0d1014f