vscode python 代码片段 个人常用

  • Post author:
  • Post category:python



{
	// 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:
	"ml often import": {
		"prefix": "mlimport",
		"body": [
			"import os",
			"import sys",
			"import pandas as pd",
			"import numpy as np ",
			"from tqdm import tqdm,trange",
			"from matplotlib import pyplot as plt",
			"import seaborn as sns",
			"import json",
			"import pathlib",
			"from pathlib import Path",
			"$2"
		],
		"description": "ml often import"
	},
	"logging basic template": {
		"prefix": "logtemplate",
		"body": [
			"import logging",
			"logging.basicConfig(",
			"format='%(asctime)s - %(name)s - %(levelname)s -%(module)s: %(message)s',",
			"datefmt='%Y-%m-%d %H:%M:%S %p',",
			"level=logging.INFO,",
			")",
		],
		"description": "logging temlate"
	},
	"logging.info": {
		"prefix": "linfo",
		"body": [
			"logging.info('$1')",
			"$2"
		],
		"description": "logging info"
	},
	"file header":{
		"prefix": "fileheader",
		"body": [
			"#!/usr/bin/env python",
			"# -*- coding: utf-8 -*-",
			"\"\"\"",
			"@DATE: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
			"@Author: xxx",
			"@File: $RELATIVE_FILEPATH",
			"@Software: vscode",
			"@Description:",
			"\t\t$1",
			"\"\"\"",
		]
	}
}




版权声明:本文为qq_34271349原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。