The codes in test.py are:
---------
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--foo', nargs='?', help='foo help')
parser.add_argument('--goo', nargs=1, help='goo help')  
args = parser.parse_args()
print(args.foo, args.goo)
---------

But I get the following result:
---------
D:\Works\Python>py test.py -h
usage: test.py [-h] [--foo [FOO]] [--goo GOO]

optional arguments:
  -h, --help   show this help message and exit
  --foo [FOO]  foo help
  --goo GOO    goo help

D:\Works\Python>py test.py --foo 1 --goo 2
1 ['2']
---------

It seems to me that the help message should be:
usage: test.py [-h] [--foo FOO] [--goo [GOO]]

Do I had missed something?

--Jach
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to