Vscode参数输入
一般使用launch.json
配置文件进行参数配置
增加输入参数
例如
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File with Arguments",
"type": "python",
"request": "launch",
"program": "${file}",
"args": ["--foo", "bar"]
}
]
}
将 “args” 属性设置为您要传递给 Python 脚本的参数。
增加环境变量
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"env": {
"MY_VAR": "some value",
"ANOTHER_VAR": "another value"
}
}
]
}
在这个示例配置中,“env” 属性指定要设置的环境变量及其值,此处包括 “MY_VAR” 和 “ANOTHER_VAR” 两个环境变量。您可以根据需要添加或删除环境变量。
请注意:如果变量的值包含空格或其他特殊字符,则必须使用引号将其括起来。例如:“MY_VAR”: “some value with spaces”。