ValueError:太多值无法解包Aptana Studio 3 [英] ValueError: Too Many Values to Unpack Aptana Studio 3

查看:83
本文介绍了ValueError:太多值无法解包Aptana Studio 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从learningpythonthehardway.org进行练习13.我应该运行以下代码:

I am working on exercise 13 from learnpythonthehardway.org. I should run this code:

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 first 2nd 3rd",并应输出:

Then enter "python ex13.py first 2nd 3rd" on command line and should output:

The script is called: ex13.py
Your first variable is: first
Your second variable is: 2nd
Your third variable is: 3rd 

但是,我在Vista上使用Aptana Studio 3并获得了 "ValueError:太多值无法解包"错误.

However, I am using Aptana Studio 3 on Vista and I get the "ValueError: too many values to unpack" error.

我是Python和Aptana的新手,所以如何在此处输入单独的参数?

I am new to Python and Aptana so how can I enter the separate arguments here?

推荐答案

这是因为len(argv)可能大于4:

>>> w,x,y,z=[1,2,3,4,5]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: too many values to unpack

尝试打印argv来查看argv实际包含的内容.

Try printing argv to see what argv actually contains.

这篇关于ValueError:太多值无法解包Aptana Studio 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆