Readlines关于购物单

f = open("购物单.txt", 'r',encoding='utf-8')
a= f.readlines()
L=[]
for i in a:
i=i.strip()
s=i.split(',')
d={}
d.update(品种=s[0],单价=s[1],数量=s[2])
L.append(d)
addr=input('输入品种')
for i in L:
if addr==i['品种']:
print('单价和数量分别为'+i['单价']+i['数量'])
输出是这样的:
"C:\Users\PC\Desktop\Python test\python.exe" "D:/Python test/readlines.py"
Traceback (most recent call last):
File "D:/Python test/readlines.py", line 8, in
d.update(品种=s[0],单价=s[1],数量=s[2])
IndexError: list index out of range

Process finished with exit code 1

望采纳,谢谢!

f = open("test.txt", 'r', encoding='utf-8')
a = f.readlines()
L = []
for i in a:
    i = i.strip()
    s = i.split(' ')
    d = {}
    d.update(品种=s[0], 单价=s[1], 数量=s[2])
    L.append(d)
addr = input('输入品种')
for i in L:
    if addr == i['品种']:
        print('单价和数量分别为'+i['单价']+' '+i['数量'])


白菜 0.9 30
萝卜 1.5 20
西红柿 3 65
西瓜 1.8 55
猪肉 23.6 69
青菜 0.9 26
酸奶 2 20
这是购物单.txt的内容
s[2]多了应该咋弄