hi
i am writing a little script and currently implementing command line
arguments following the guide by mark pilgrim from dive into python;
thats all fine, however i am not sure of the BEST way to handle
multiple command line arguments
for my script, i want to be able to accept two arguments, a name and a
url, but i am not sure if its best to use one command line option/flag
(eg -n to specify name) and then grab the url from the extra data
which will be in 'args':
opts, args = getopt.getopt(s ys.argv[1:], "n:", ["name="])
or to have two command line options/flags, -n and -u, and checking
that these have both been specified and then proceeding (this might be
a little messier)
any tips would be much appreciated
thanks in advance
jon
i am writing a little script and currently implementing command line
arguments following the guide by mark pilgrim from dive into python;
thats all fine, however i am not sure of the BEST way to handle
multiple command line arguments
for my script, i want to be able to accept two arguments, a name and a
url, but i am not sure if its best to use one command line option/flag
(eg -n to specify name) and then grab the url from the extra data
which will be in 'args':
opts, args = getopt.getopt(s ys.argv[1:], "n:", ["name="])
or to have two command line options/flags, -n and -u, and checking
that these have both been specified and then proceeding (this might be
a little messier)
any tips would be much appreciated
thanks in advance
jon
Comment