optparse: add trailing text in help message?

Steven Bethard steven.bethard at gmail.com
Sun Oct 15 02:38:30 CEST 2006


Duncan Booth wrote:
>>>> from optparse import OptionParser
>>>> usage = "usage: %prog [options] arg1 arg2"
>>>> epilog = "that's all folks!"
>>>> parser = OptionParser(usage=usage, epilog=epilog)
>>>> parser.parse_args(['', '--help'])
> Usage:  [options] arg1 arg2
> 
> Options:
>   -h, --help  show this help message and exit
> 
> that's all folks!

Very cool.  Thanks!  I'll update argparse to share this API.

STeVe



More information about the Python-list mailing list