本篇簡要介紹下如何使用 PyCharm 設置默認的作者信息和腳本模板。
PyCharm >> Preferences/Settings >> Editor >> File and Code Templates >> Python Script >> 設置內容 >> 點擊 Apply。
可自定義作者信息和腳本模板,后續創建新的 python 腳本時,會自動生成如下腳本內容。
可以把一些自己常用的基礎代碼設置成模板。
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : ${DATE} # @Author : starnight_cyber # @Github : https://github.com/starnightcyber # @Software: ${PRODUCT_NAME} # @File : ${NAME}.py import requests from requests.packages.urllib3.exceptions import InsecureRequestWarning import ssl import time # Do not support ssl and disable warning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) ssl._create_default_https_context = ssl._create_unverified_context timestamp = time.strftime("%Y-%m-%d", time.localtime(time.time())) def test(): # write your code here pass if __name__ == '__main__': test() pass
Refer ~
https://blog.csdn.net/u010105243/article/details/76154251