An optparse question

dan.gass at gmail.com dan.gass at gmail.com
Fri Jul 21 16:37:28 EDT 2006


> No, that affects the string printed only *after* the "usage = " string.
>  What I would like to do is insert some string *before* the "usage = "
> string, which is right after the command I type at the command prompt.
> So I would like to make it look like this:

The example was fine (except for a typo) as far as demonstrating the
concept.  Try this corrected version:

from optparse import OptionParser

usage = '************ THIS IS NEWLY INSERTED STRING
************\nusage: %prog [options] input_file'
parser = OptionParser(usage=usage)
parser.print_help()




More information about the Python-list mailing list