How python parse the value to var

blackwhite blackwhite at gmail.com
Thu Sep 2 23:08:56 EDT 2004


[Code as follows:]

args_list, names = getopt.getopt( sys.argv[1:] , "n:j:h") 
args = {}
for (a, v) in args_list:
        args[a] = v

>>>The question is:
If  i use cmd line as
xxx.exe -n A -j B 123.txt 456.jpg
The output will be
args_list will be[('-n','A'),('-j','B')]
names     will be['123.txt','456.jpg']

>>>>>>>>How python parse the value to them(args_list&names)



More information about the Python-list mailing list