相关疑难解决方法(0)

Python:如何在optparse中提供选项?

我已经阅读了这篇http://docs.python.org/release/2.6.2/library/optparse.html

但是我不太清楚如何在optparse中选择一个选项?

我试过设置"required = 1"但是我收到了一个错误:

无效的关键字参数:必需

我想让我的脚本需要--file选项由用户输入.我知道action当你不--file为其提供价值时,关键字会给你错误action="store_true".

python command-line command-line-arguments

36
推荐指数
4
解决办法
5万
查看次数