Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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 !
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #argparse #argument
ADD COMMENT
Topic
Name
8+7 =