"Count László de Almásy" <[EMAIL PROTECTED]> wrote: > Is there a standard way with optparse to include a blurb of text after > the usage section, description, and the list of options? This is > often useful to include examples or closing comments when the help > message is printed out. Many of the GNU commands do this.
Yes, but only if you are running in Python 2.5. >From "What's new in Python 2.5": > The optparse module was updated to version 1.5.1 of the Optik library. > The OptionParser class gained an epilog attribute, a string that will > be printed after the help message, and a destroy() method to break > reference cycles created by the object. (Contributed by Greg Ward.) In other words: >>> 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! -- http://mail.python.org/mailman/listinfo/python-list