1. 程式人生 > >Pycharm建立檔案模板

Pycharm建立檔案模板

轉載於https://blog.phpgao.com/pycharm_template.html

進入File->settings->Editor->File and Code Templates->Python Script

新增以下內容:

#!/usr/bin/env python
# encoding: utf-8

#set( $SITE = "http://www.phpgao.com" )

"""
@version: ??
@author: phpergao
@license: Apache Licence 
@contact: [email protected]
@site: ${SITE}
@software: ${PRODUCT_NAME}
@file: ${NAME}.py
@time: ${DATE} ${TIME}
"""
def func(): pass class Main(): def __init__(self): pass if __name__ == '__main__': pass

指令碼中還可以新增自定義變數!

#!/usr/bin/env python
# encoding: utf-8


#set( $SITE = "http://blog.csdn.net/qq_19175749/" )


"""
@version: python2.7
@author: ‘$USER‘
@license: Apache Licence 
@contact: [email protected]
@site: ${SITE}
@software: ${PRODUCT_NAME}
@file: ${NAME}.py
@time: ${DATE} ${TIME}
"""


參考連結: