vscode 自动添加头部注释

 依次单击菜单栏 “File”—“Preferences”—“User Snippets”,然后选择python后会生成python.json文件,将该文件内容替换为以下内容:

{
"file header": 
    {
        "prefix": "py",
        "body": [
        "# !/usr/bin/python",
		"# -*- coding: utf-8 -*-"
		"\"\"\"",
		"@File    :   $TM_FILENAME",
		"@Time    :   $CURRENT_YEAR/$CURRENT_MONTH/$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
		"@Author  :   SanZhang",
		"@Version :   1.0",
		"@Contact :   [email protected]",
		"@License :   (C)Copyright 2019-2020",
		"@Desc    :   None",
		"\"\"\"",
		"",
	],
	"description": "file header"
    }
}

保存修改即可。

新建一个python文件,然后在头部敲入 py 即可自动弹出注释:

你可能感兴趣的:(编辑器相关)