我有一个现有的菜单,可以为您提供选项L
或D
. L
应该加载文件的内容并D
显示它。
if option == "l" or option == "L":
with open("packages.txt") as infp:
for line in infp:
line = line.rstrip()
name,adult,child= line.split(',')
if option == "d" or option == "D":
print ((name)," - ",(adult)," / ",(child))
但是,当我尝试运行它时,我得到了错误:
name,adult,child= line.split(',')
ValueError: need more than 1 value to unpack
为什么我会收到此错误?