How python parse the value to var

B

blackwhite

[Code as follows:]

args_list, names = getopt.getopt( sys.argv[1:] , "n:j:h")
args = {}
for (a, v) in args_list:
args[a] = v
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']
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,205
Messages
2,571,067
Members
47,673
Latest member
MahaliaPal

Latest Threads

Top