从文件中提出ARGPARSE论点(编辑以更好地解释问题)
一个快速的问题:
如果我想从文件中的argparse中添加参数,以便我可以在例如Visual Studio中执行文件,我应该如何执行此操作?
原因既是学习和调试。
例如,如果我有
parser.add_argument('-vid', '--video', type=str, help="Path to video file to be used for inference (conflicts with -cam)")
一个我没有编写的脚本,我想从VS运行它以进行更改,并且(希望不是我的新手Python)调试我的更改。 该脚本有很多参数(argpars),我想直接“填写” VS中的“填写”,以便能够从VS运行脚本。
如果更容易删除整个argpars功能,这将是一个选项(我可以在完成后稍后再添加),但是如果可以直接在代码中“填充它们”,那将是很棒的。
VS有一种方法可以通过解决方案 - 选项,但这会使编辑更加棘手。
因此,例如,如果(如上所述)有一个解析器,可以在某种程度上添加为(代码猜测/释义);
video_path ='d:\ path \ to \ video -file.mpg4'
- video = video_path
我该如何在文件打开vs vs中以能够从那里运行它时添加-vid的路径?
是否有一种方法可以添加诸如“如果没有-vid(来自argparse)的vid(来自代码中添加的路径)?
A quick question:
If I would like to add arguments in argparse from within the file so that I can execute the file in for example Visual Studio, how should I do this?
The reason is both for learning and debugging.
For example, if I have this
parser.add_argument('-vid', '--video', type=str, help="Path to video file to be used for inference (conflicts with -cam)")
I have a script that I did not write and I would like to run it from VS to make changes and (hopefully not but probably as I'm new to python) debug my changes.
the script has a bunch of arguments (argpars) that I would like to "fill in" direct in VS to be able to run the script from VS.
If it's easier to delete the entire argpars-function this would be an option (I could add this again later when I'm done) but if it's possible to "fill them" direct in the code that would be great.
There is a way in VS to go through solution - options, but that makes editing a bit trickier.
So for example if (as above) there is a parser-argument for --video, could this in someway be added as (code-guessing/paraphrasing);
video_path = 'd:\path\to\video-file.mpg4'
--video = video_path
How would I do to add the path for the -vid when the file is open in VS to be able to run it from there?
Is there a way to add something like "if no -vid (from argparse) run with -vid (from path added in the code)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论