【发布时间】:2021-05-29 06:38:52
【问题描述】:
使用以下代码:
print("Welcome to band name generator!!")
city,pet = input("What is the name of the city you grew up in?\t") + input ("\nWhat is the name of your first pet?\t")
print("\n\t Your band name can be " + city + " "+ pet + "!!")
我可以输入单个变量(例如 - a/b/c 或 1/2/3)并且程序运行良好,但是我们输入字符串值或单词(例如 - Canada,New_york),我收到以下错误 - 要解压的值太多(预计 2 个)
如何在一行输入的同时解决这个问题?
【问题讨论】:
-
您正在将 Canada,New_york 分配给一个单值城市。因此错误
标签: python python-3.x multiple-input