from sys import argv
script, first, second, third = argv
print "The script is called:", script
print "Your first variable is:", first
print "Your second variable is:", second
print "Your third variable is:", third
如何获得如下所示的输出
The script is called: script.py
Your first variable is: first
Your second variable is: 2nd
Your third variable is: 3rd
获得了该计划
答案 0 :(得分:0)
您需要命名脚本script.py
,然后从命令行运行它,如下所示:
python script.py first 2nd 3rd