Equivalent of perl's Pod::Usage?
Ryan Ginstrom
software at ginstrom.com
Mon Dec 10 18:01:43 EST 2007
> On Behalf Of Nick Craig-Wood
> As for Pod::Usage - write the instructions for your script as
> a docstring at the top of your file, then use this little function...
>
> def usage(error):
> """
> Print the usage, an error message, then exit with an error
> """
> print >>sys.stderr, globals()['__doc__']
> print >>sys.stderr, error
> sys.exit(1)
argparse[1] also prints out very pretty usage for you.
[1] http://argparse.python-hosting.com/
Regards,
Ryan Ginstrom
More information about the Python-list
mailing list