我做错了什么来获得ValueError:需要多于1个值才能解压缩

时间:2014-03-05 03:25:39

标签: python-3.x

from sys import argv

script, user_name = argv
prompt = '> '

print ("Hi %s, I'm the %s script." % (user_name, script))
print ("I'd like to ask you a few questions.")
print ("Do you like me %s?" % user_name)
likes = input(prompt)

print ("Where do you live %s?" % user_name)
lives = input(prompt)

print ("What kind of computer do you have?")
computer = input(prompt)

print ("""
Alright, so you said %r about liking me.
You live in %r. Not sure wher that is.
And you have a %r computer. Nice.
""" % (likes, lives, computer))

1 个答案:

答案 0 :(得分:0)

根据以下行,该程序应该传递1个参数(程序文件名本身除外):

script, user_name = argv

您应该使用用户名启动该程序:

python script_file.py username