Message245659
Tested on argdest.py:
#!/usr/bin/env python3
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('x', action='append')
parser.add_argument('x', action='append_const', const=42, metavar='foo')
parser.add_argument('x', action='append_const', const=43, metavar='bar')
parser.add_argument('-x', action='append_const', const=44)
args = parser.parse_args()
print(args)
Run:
[guest@localhost debug]$ ./argdest.py -h
usage: argdest.py [-h] [-x] x
positional arguments:
x
foo
bar
optional arguments:
-h, --help show this help message and exit
-x
[guest@localhost debug]$ ./argdest.py -x 1 -x
Namespace(x=[44, '1', 42, 43, 44])
[guest@localhost debug]$
LGTM. |
|
Date |
User |
Action |
Args |
2015-06-22 23:14:56 | py.user | set | recipients:
+ py.user, paul.j3 |
2015-06-22 23:14:56 | py.user | set | messageid: <1435014896.45.0.313921723311.issue24419@psf.upfronthosting.co.za> |
2015-06-22 23:14:56 | py.user | link | issue24419 messages |
2015-06-22 23:14:56 | py.user | create | |
|