我目前正在学习《艰难地学习Python》。我认为这个例子可能已经过时了,所以我想在这里得到反馈。
我正在使用Python 3.1
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))
我收到此错误:
Traceback (most recent call last):
File "/path/ch13.py", line 3, in <module>
script, first, second, third, bacon = argv
ValueError: need more than 1 value to unpack
知道出了什么问题吗?
您忘记将参数传递给脚本,例如foo.py bar baz quux
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)