getopt
Peter Otten
__peter__ at web.de
Sat Nov 15 15:33:49 EST 2003
Don Low wrote:
> I'm going over a script that demonstrates the getopt function. I include
> the script here:
I you are only now exploring the possibilities of getopt, you might want to
leapfrog and use the more powerful optparse module.
> options, xarguments = getopt.getopt(sys.argv[1:], 'ha', \
> ['file=', 'view=', 'version', 'python-version'])
If you want the "a" option to require an argument, you have to append a
colon serving the same purpose as the "=" for long options:
options, xarguments = getopt.getopt(sys.argv[1:], 'ha:', \
['file=', 'view=', 'version', 'python-version'])
Peter
More information about the Python-list
mailing list