1、進入vscode選擇檔案,首選項下的使用者代碼片段

2、彈出框輸入Python後回車
3、彈出檔案(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",
"# -*- coding: utf-8 -*-",
"'''",
"@File : $TM_FILENAME",
"@Time : $CURRENT_YEAR/$CURRENT_MONTH/$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
"@Author : CrissChan ",
"@Version : 1.0",
"@Site : https://blog.csdn.net/crisschan",
"@Desc : None",
"'''",
"",
"$0"
],
}
}
4、在建立python檔案中,頭部輸入header,然後回車就在檔案中加入了你想使用的頭部内容