打開或新建一個python源文件,按下快捷鍵Ctrl+Shift+B
運行,VSC會提示No task runner configured.
,點擊「Configure Task Runner」,選擇「Others」,輸入如下內容並保存:python
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "0.1.0", "command": "${workspaceRoot}/venv/bin/python", "isShellCommand": true, "args": ["${file}"], "showOutput": "always" }
"files.exclude":{"**/.git": true,"**/.svn": true,"**/.hg": true,"**/.DS_Store": true,"**/*.pyc":true}
//將設置放入此文件中以覆蓋默認值和用戶設置。
{
"python.pythonPath":"${workspaceRoot}/venv/bin/python",
"editor.renderWhitespace":"all",
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.formatting.provider":"yapf",
//配置 glob 模式以排除文件和文件夾。
"files.exclude":{
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/.DS_Store": true,
"**/*.pyc":true
}
}
prefix :這個參數是使用代碼段的快捷入口,好比這裏的log在使用時輸入log會有智能感知. body :這個是代碼段的主體.須要設置的代碼放在這裏,字符串間換行的話使用\r\n換行符隔開.注意若是值裏包含特殊字符須要進行轉義. $1 :這個爲光標的所在位置. $2 :使用這個參數後會光標的下一位置將會另起一行,按tab鍵可進行快速切換 description :代碼段描述,在使用智能感知時的描述
{
/*
//Place your snippets forPython 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.Placeholderswith the
// same ids are connected.
//Example:
"Print to console":{
"prefix":"log",
"body":[
"console.log('$1');",
"$2"
],
"description":"Log output to console"
}
*/
"Input Note":{
"prefix":"itne",
"body":[
"'''",
"Function Name : diff_Json_Same",
"Function : 通用比較xx方法",
"Input Parameters: jsonastr,jsonbstr",
"Return Value : None",
"'''"
],
"description":"Input the class or function notes!"
}
}