In <[EMAIL PROTECTED]>, Ritesh Raj Sarraf wrote: > My program uses mostly "option arguments" hence my len(args) value is always > zero. I need to check if the user has passed the correct number of "option > arguments". Something like: > > (options,args) = parser.parse_args() > > len(options) != 1 or len(options) > 2: > print "Incorrect number of arguments passed." > > How do I accomplish it ?
Just insert an ``if`` in front of the condition and end the program with ``sys.exit()`` after the message. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list