书中代码:
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
修改代码为:
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)
输出结果:
python ex13.py 1 2 3
附加题:
1、给你的脚本三个以下的参数。看看会得到什么错误信息。试着解释一下?
ValueError: not enough values to unpack (expected 4, got 3)