I have a question regarding python\'s argparse: Is it possible to have a optional argument, which does not require positional arguments?
Example:
parser.
You get error: to few arguments
because lat
and lon
arguments are required.
In [10]: parser.parse_args('--list-methods'.split())
ipython: error: too few arguments
but
In [11]: parser.parse_args('--list-methods 10 20'.split())
Out[11]: Namespace(lat='10', list_methods=True, lon='20', method='add')
You should make lat
and lon
arguments optional.