vscode automatically adds header comments

 Click the menu bar "File" - "Preferences" - "User Snippets" in turn, and then select python to generate a python.json file, replace the content of the file with the following content:

{
"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"
    }
}

Just save the changes.

Create a new python file, and then type py in the head to automatically pop up comments:

Guess you like

Origin blog.csdn.net/qq_37768971/article/details/107934327