Python Argparse der eine oder andere

import argparse

parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group(required=True) # <---
group.add_argument('--foo',action=.....)
group.add_argument('--bar',action=.....)
args = parser.parse_args()

# With this group (mutually_exclusive) one can specify that only one
# of the added arguments should be accepted.
Jakin687