我正在运行一个接受一些命令行参数的python程序。在Visual Studio代码中构建程序时,如何提供这些参数?
最佳答案
通过在launch.json的args
设置中定义参数,可以将参数传入程序,定义如下:json{ "name": "Python", "type": "python", "pythonPath":"${config.python.pythonPath}", "request": "launch", "stopOnEntry": true, "console": "none", "program": "${file}", "cwd": "${workspaceRoot}", "args":["arg1", "arg2"], "env": {"name":"value"}}
有关更多信息,请访问文档网站:https://github.com/DonJayamanne/pythonVSCode/wiki/Debugging#args
关于python - 使用Visual Studio代码中的参数运行Python程序,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40036942/