【发布时间】:2016-05-01 13:03:59
【问题描述】:
现在我的脚本通过以下方式调用:
python resylter.py -n *newfile* -o *oldfile*
代码如下:
parser.add_argument('-n', '--newfile', help='Uses only with -o argument. Compares inputed OLD (-o) file with previous run results with NEW(-n) output.xml file with actual run results')
parser.add_argument('-o', '--oldfile', help='Uses only with -n argument. Compares inputed OLD (-o) file with previous run results with NEW(-n) output.xml file with actual run results')
还有一些动作
我如何编辑它以像这样使用?:
python resylter.py -n *newfile* *oldfile*
sys.argv[-1] 不起作用
【问题讨论】:
-
我不认为这会有用。我只是将
oldfile保留为positional argument(即parser.add_argument('oldfile', ...))
标签: python command-line argparse