您是否期望
player成为一个
dict而不是一个
list?
>>> player=[1,2,3]>>> player["score"]Traceback (most recent call last): File "<stdin>", line 1, in <module>TypeError: list indices must be integers, not str>>> player={'score':1, 'age': 2, "foo":3}>>> player['score']1
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)