I would like to have a optional argument that will default to a value if only the flag is present with no value specified, but store a user-specified value instead of the de
The difference between:
parser.add_argument("--debug", help="Debug", nargs='?', type=int, const=1, default=7)
and
parser.add_argument("--debug", help="Debug", nargs='?', type=int, const=1)
is thus:
myscript.py => debug is 7 (from default) in the first case and "None" in the second
myscript.py --debug => debug is 1 in each case
myscript.py --debug 2 => debug is 2 in each case