< YALU STUDIO >

PyCharm Python file template

Word count: 109 / Reading time: 1 min
2018/08/04 Share

To automatically insert information at the top when creating a Python file, go to:

(Mac) PyCharm > Preferences… > File and Code Templates > Python Script

(Windows) File > Settings > Editor > File and Code Templates > Python Script

My current setting:

1
2
3
4
5
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Filename: ${NAME}.py
# @Author: ${USER}
# @Time: ${DATE} ${TIME}

Some variables that can be used:

Variable Function Example
${PROJECT_NAME} current project’s name Python_Scripts
${NAME} filename test
${USER} current user Yalu
${DATE} current system date 3/08/2018
${TIME} current system time 11:32 PM
${YEAR} current year 2018
${MONTH} current month 08
${MONTH_NAME_SHORT} current month Aug
${MONTH_NAME_FULL} current month August
${DAY} current day 03
${HOUR} current hour 11
${MINUTE} current minute 32
${PRODUCT_NAME} current IDE PyCharm
CATALOG