我已经阅读了这篇http://docs.python.org/release/2.6.2/library/optparse.html
但是我不太清楚如何在optparse中选择一个选项?
我试过设置"required = 1"但是我收到了一个错误:
无效的关键字参数:必需
我想让我的脚本需要--file选项由用户输入.我知道action当你不--file为其提供价值时,关键字会给你错误action="store_true".
--file
action
action="store_true"
python command-line command-line-arguments
command-line ×1
command-line-arguments ×1
python ×1