2
现在我的脚本调用通过:Argparse与一个参数的两个值
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] di dn't可与nargs = '*'
使用参数'nargs ='*'' –
我不认为这会有用。我只是把'oldfile'作为[位置参数](https://docs.python.org/3/library/argparse.html#name-or-flags)(即'parser.add_argument('oldfile',. ..)') – soon