vscode添加python文件头模板(Mac版)

1.打开vscode,Preference-User Snippets, 搜索Python.json文件

2.修改python.json配置文件

{
	// Place your snippets for python here. Each snippet is defined under a snippet name and has a prefix, body and 
	// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
	// same ids are connected.
	// Example:
	// "Print to console": {
	// 	"prefix": "log",
	// 	"body": [
	// 		"console.log('$1');",
	// 		"$2"
	// 	],
	// 	"description": "Log output to console"
	// }
	"HEADER":{
		"prefix": "header",
		"body": [
		"#!/usr/bin/env python",
		"# -*- encoding: utf-8 -*-",
		"'''",
		"@File    :   $TM_FILENAME",
		"@Time    :   $CURRENT_YEAR/$CURRENT_MONTH/$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
		"@Author  :   软件质量保障",
		"@Email   :   xxxxx@163.com",
		"@Blog    :   https://www.zhihu.com/people/iloverain1024",
		"@Copyright : 侵权必究",
				
		"'''",
		"",
		"# here put the import lib",
		"$0"
		],
	}
}

3.使用头文件

 

posted @ 2022-07-24 18:24  QualityAssurance21  阅读(251)  评论(0编辑  收藏  举报