I'm trying to write a python script using argparse
which sets a value to True
if -d
has been set.
Here is what I'm trying:
parser.add_argument("-d", "--dynamic", required=False)
dynamic = False
if args.dynamic is not None:
dynamic = True
I get the following error:
usage: psd.py [-h] -f FILE [-d DYNAMIC] psd.py: error: argument -d/--dynamic: expected one argument
How do I set the flag to expect 0 arguments?