sys模块中的 sys.argv[] 用语获取命令行参数。
#-*- coding:utf-8 -*-import sysif len(sys.argv)<2: print "Lack of param" else : for i in range(len(sys.argv)): if sys.argv[i].startswith("--"): print "param" + str(i) + ":" + sys.argv[i][2:] else: print "param" + str(i) + ":" + sys.argv[i]