vscode大法好!!!

参考官方文档,那里啥都有https://code.visualstudio.com/docs

快捷键

记录一些比较有用的快捷键,在平常使用vsc时有意识的去使用。

调试程序

1. 快速调出Debug view,⇧⌘D, 当然点击左边栏的虫子也挺快的。

2. 调试带有参数的Python程序。

因为调试的程序带有参数,例如:python mnist_cnn_test.py --model-dir model --batch-size 5000 --use-ensemble False,其中带有三个参数,直接运行’DEBUG’就不会把参数带进去,我们可以打开launch.jsonopen launch.json,然后在configurations:中的Python: Current File (Integrated Terminal),添加args,具体如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args": [
"--model-dir",
"model",
"--batch-size",
"5000",
"--use-ensemble",
"False"
]
},...省略后边内容

Comments

⬆︎TOP