Date: Sat, 4 Nov 2006 10:36:58 +0000
From: "Asrarahmed Kadri" < [EMAIL PROTECTED]>
Hi Folks,
I am trying to build a program which takes the following command-line
arguments:
*-s <IP address> -D <start date> -n <no. of days> -t <start time> <end
time>*
the first argument which is -s (for source) can be replaced by -d (for
destination) or -o (for observer) or -r (for reporter). Now what I want is
to make sure that the user only supplies one of the options from the 4
alternatives.
I am using 'optparse' module. It has got a nice feature taht enables you to
give the option name, along with the variable-name to store the value of
that option. The syntax is as under:
if you import sys you can use sys.argv to look at a list of all the command line arguments (including the programs filename). You should be able to determine if you have duplicate flags ('-s','-d',etc).
hth
--greg
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor