Python argparse empty argument

Code examples

0
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 !

Similar pages

Similar pages with examples

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................