[issue9653] New default argparse output to be added

Steven Bethard report at bugs.python.org
Mon Aug 23 00:06:39 CEST 2010


Steven Bethard <steven.bethard at gmail.com> added the comment:

Sorry, typo. Should have been len(sys.argv) == 1. Full script:

import argparse
import sys

parser = argparse.ArgumentParser()
parser.add_argument('--foo')

if len(sys.argv) == 1:
    parser.print_help()  
else:
    print(parser.parse_args())

With that script, I see:

$ ./python.exe temp.py 
usage: temp.py [-h] [--foo FOO]

optional arguments:
  -h, --help  show this help message and exit
  --foo FOO

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9653>
_______________________________________


More information about the Python-bugs-list mailing list