optparse commandline

vvikram at gmail.com vvikram at gmail.com
Sun Jul 8 05:59:29 EDT 2007


I want to call some function from my program and just pass it a
commandline. It should parse the commandline and return back a list of
parsed arguments (just like the sys.argv list)

Example:
foo.parse_cmdline("/usr/bin/foorun -v -d -h")
==> ['/usr/bin/foorun', '-v', '-d','-h']

Any suggestions on how to do this are appreciated.

Regards
Vikram




More information about the Python-list mailing list