2023-06-01

Is there a way to require a mutually exclusive group, where one of the groups has multiple options?

I would like a behavior where exactly one of

  • --a
  • --b AND --c

are required. I know how to do it if the second requirement were just --b:

group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--a', type=str)
group.add_argument('--b', type=str)


No comments:

Post a Comment