python - 如何制作带参数的命令行程序?

标签 python windows command-line

如何制作命令行,以便我可以在 Windows 上使用一些参数执行我的程序...

例如:

C:/Program/App.exe -safemode

最佳答案

看看getoptoptparse来自标准库的模块,关于更高级的 argparse 也可以说很多好东西模块。

通常你只需要访问sys.argv

关于python - 如何制作带参数的命令行程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2335989/

相关文章:

python - 名称错误 : name 'buffer' is not defined with Ant Based framework batch file

windows - 如何在不连接到 Internet 的情况下运行 docker 镜像?

java - 将 java 结果传递到命令行

java - 在命令行上增加 jMeter 的内存

java - 从 cmd 编译 java 程序时,我得到 "error: cannot find symbol",但在 Eclipse 中却没有

C++ 嵌入式 Python :pass Tuple declared in C++ to a method of a python class

python - Raspberry Pi 照相亭打印

ASP.NET Core publish 在 published 文件夹中产生大量 DLL,为什么?

python - 网络驱动程序错误 : "No alert is present" after UnexpectedAlertPresentException is thrown

Python/NumPy : implementing a running sum (but not quite)