On Aug 14, 12:18 am, Javier Collado <javier.coll...@gmail.com> wrote: > 2009/8/14 Steven Woody <narkewo...@gmail.com>: > > > Hi, > > I am using OptionParser, but I've not managed figure out a way to support > > what I wanted command line format "prog <cmd> [options] [arguments]". > > E.g., "svn ls -r123http://hello.world". Can I do this using OptionParser? > > Thanks. > > Hello, > > I think that this isn't possible with optparse library.
It's possible if you remove sys.argv[1] before invoking optparse. But... > However, it's possible with argparse (http://code.google.com/p/argparse/): > http://argparse.googlecode.com/svn/trunk/doc/other-methods.html#sub-c... > > It's not a standard library, but it's worth to take a look at it. It's more than worth looking at, it's a slam dunk. It's superior to optparse in every way I can think of. Unless you don't want the third- party dependency there is no reason to use optparse instead of argparse. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list