我收到这个值错误? [英] I am getting this value error?
问题描述
我收到一个值错误:
Traceback(最近一次调用最后一次):
文件C:\ Users \\ \\ ubaid Parveez \Documents\Python\Arguments.py,第18行,在< module>
脚本,user_name = argv
ValueError:值不够打开包装(预计2,得1)
我尝试过:
来自sys import argv
script,user_name = argv
prompt ='>'
print(fHi {user_name},我是{script}脚本。)
print(我,d想问你几个问题)
打印(f你喜欢我{user_name}吗?)
赞=输入(提示)
打印(f你住在哪里{user_name})
生活=输入(提示)
打印(f你有什么样的电脑?)
电脑=输入(提示)
print(f好吧,所以你说{likes} a回合喜欢我。\ n你住在{lives}。不确定那里是什么\ n你有一个{computer})
I am getting a value error :
Traceback (most recent call last):
File "C:\Users\Ubaid Parveez\Documents\Python\Arguments.py", line 18, in <module>
script, user_name = argv
ValueError: not enough values to unpack (expected 2, got 1)
What I have tried:
from sys import argv
script, user_name = argv
prompt = '>'
print(f"Hi {user_name}, I'm the {script} script.")
print("I,d like to ask you a few questions")
print(f"Do you like me {user_name} ? ")
likes = input(prompt)
print(f"Where do you live {user_name} ")
lives = input(prompt)
print(f"What kind of computer you have?")
computer = input(prompt)
print (f"Alright, so you said {likes} about liking me. \n You live in {lives} . Not sure where that is \n And you have a {computer} ")
推荐答案
这都是错误信息!
It is all in the error message !
script, user_name = argv
ValueError: not enough values to unpack (expected 2, got 1)
代码需要2值,但 argv
只有一个。
这篇关于我收到这个值错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!