* Thomas 'PointedEars' Lahn (Thu, 12 May 2011 22:22:20 +0200) > Thorsten Kampe wrote: > > I'm using optparse for a little Python script. > > > > 1. The output from "--help" is: > > """ > > Usage: script.py <arg> > > > > script.py does something > > > > Options: > > -h, --help show this help message and exit > > """ > > > > I would prefer to have the description before the usage, like... > > """ > > script.py does something > > > > Usage: script.py <arg> > > > > Options: > > -h, --help show this help message and exit > > """ > > [...] > > Is that possible with either optparse or the "new kid on the block" > > argparse. If so how? > > You can easily have #1 with optparse.OptionParser(usage="…")¹, but optparse > is deprecated in favor of argparse.ArgumentParser.
I'm already using usage. That's where optparse has it from. Putting the usage message into the description and vice versa is of course not a viable way to go. Thorsten -- http://mail.python.org/mailman/listinfo/python-list