T wrote: > fuzzylollipop wrote: > >>you can make the usage line anything you want. >> >>... >>usage = 'This is a line before the usage line\nusage %prog [options] >>input_file' >>parser = OptionsParser(usage=usage) >>parser.print_help() >>... >> > > > 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: > > % myprog.py -h > ************ THIS IS NEWLY INSERTED STRING ************ > usage: myprog.py [options] input_file > > > options: > -h, --help show this help message and exit > -v, --verbose print program's version number and exit > -o FILE Output file > Do a Google search for "monkey patching". You probably want to monkey-patch the class's usage method.
regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list