Answers for "python argparse argument without value"

0

argparse one argument or without argument

parser.add_argument("-a", "--automatic", nargs="?", const=8, type=int)
Posted by: Guest on January-10-2022
0

python argparse argument without value

To create an option that needs no value, set the action [docs]
of it to 'store_const', 'store_true' or 'store_false'.

Example:

parser.add_argument('-v', '--verbosity', action='store_true')

! No 'type=xy' is needed !
Posted by: Guest on March-23-2022

Python Answers by Framework

Browse Popular Code Answers by Language