getopt

Bernard Yue bernie at 3captus.com
Tue Jun 11 11:50:37 EDT 2002


Hi,

I was expecting an exception from the following getopt.getopt() called,
but didn't.  Is it normal?  I've try with Python 2.1 and 2.2 as well. 
Result starts the same.


Python 2.3a0 (#1, Jun  7 2002, 14:47:32) 
[GCC 2.95.3 20010315 (SuSE)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import getopt
>>> args = '-a -b -c -d bar a1 a2'.split()
>>> args
['-a', '-b', '-c', '-d', 'bar', 'a1', 'a2']
>>> optlist, args = getopt.getopt(args, 'abc:d:')
>>> optlist
[('-a', ''), ('-b', ''), ('-c', '-d')]
>>> args
['bar', 'a1', 'a2']
>>> 

Thanks in advance!


Bernie



More information about the Python-list mailing list