小编suv*_*rev的帖子

Argparse有一个参数的两个值

现在我的脚本调用:

python resylter.py -n *newfile* -o *oldfile*
Run Code Online (Sandbox Code Playgroud)

代码看起来像:

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')
Run Code Online (Sandbox Code Playgroud)

和一些行动

如何编辑它才能像这样使用?:

python resylter.py -n *newfile* *oldfile*
Run Code Online (Sandbox Code Playgroud)

sys.argv [-1]没有用

python command-line argparse

7
推荐指数
2
解决办法
4609
查看次数

标签 统计

argparse ×1

command-line ×1

python ×1