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 | #!/usr/bin/env python |
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 |