1.按照下面路徑以此打開
1
|
file →→settings→→editor→→ file and code templates |
右側找到python script,如下圖
2.設置相關代碼
如下
1
2
3
4
5
6
7
|
##!/usr/bin/python3 # -*- coding: utf-8 -*- # @time : ${date} ${time} # @author : 未來戰士biubiu!! # @filename: ${name}.py # @software: ${product_name} # @blog :http://blog.csdn.net/u010105243/article/ |
設定的規則說明如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
(a)shebang行 #!/usr/bin/python3 (b)預定義的變量要擴展為格式為$ {<variable_name>}的相應值。 可用的預定義文件模板變量為: $ {project_name} - 當前項目的名稱。 $ {name} - 在文件創建過程中在“新建文件”對話框中指定的新文件的名稱。 $ {user} - 當前用戶的登錄名。 $ {date} - 當前的系統日期。 $ {time} - 當前系統時間。 $ {year} - 今年。 $ {month} - 當月。 $ {day} - 當月的當天。 $ {hour} - 目前的小時。 $ {minute} - 當前分鐘。 $ {product_name} - 將在其中創建文件的ide的名稱。 $ {month_name_short} - 月份名稱的前 3 個字母。 示例: 1 月, 2 月等 $ {month_name_full} - 一個月的全名。 示例: 1 月, 2 月等 |
以上這篇在pycharm中自動添加時間日期作者等信息的方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持服務器之家。
原文鏈接:https://blog.csdn.net/u010105243/article/details/76154251