VSCode设置Python文件模板

2024-02-05  本文已影响0人  87d6dc4b11a7

文件首选项配置用户代码片段,输入python,点击回车,打开python.json。添加如下内容:

{
    "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  :   python",
        "@Version :   1.0",
        "@Contact :   python@qq.com",
        "@License :   (C)Copyright 2017-2018, Liugroup-NLPR-CASIA",
        "@Desc    :   None",
        
        "'''",
        "",
        "# here put the import lib",
        "$0"
        ],
    }
}

使用

新建python文件,输入header回车就会自动生成文件头。

上一篇下一篇

猜你喜欢

热点阅读