Python argparse mutual exclusive group
What I need is: pro [-a xxx | [-b yyy -c zzz]] I tried this but does not work. Could someone help me out? 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") Thanks! add_mutually_exclusive_group doesn't make an entire group mutually exclusive. It makes