相关疑难解决方法(0)

Python argparse互斥组

我需要的是:

pro [-a xxx | [-b yyy -c zzz]]
Run Code Online (Sandbox Code Playgroud)

我尝试了这个但是没有用.有人可以帮帮我吗?

group= parser.add_argument_group('Model 2')
group_ex = group.add_mutually_exclusive_group()
group_ex.add_argument("-a", type=str, action = "store", default = "", help="test")
group_ex_2 = group_ex.add_argument_group("option 2")
group_ex_2.add_argument("-b", type=str, action = "store", default = "", help="test")
group_ex_2.add_argument("-c", type=str, action = "store", default = "", help="test")
Run Code Online (Sandbox Code Playgroud)

谢谢!

python argparse

75
推荐指数
3
解决办法
4万
查看次数

标签 统计

argparse ×1

python ×1