Crossin的编程教室

标题: 保存数据那游戏出错了 [打印本页]

作者: AragakiYui    时间: 2018-7-13 10:55
标题: 保存数据那游戏出错了
应该怎么转

TIM图片20180713105455.png (26.93 KB, 下载次数: 443)

Traceback (most recent call last): File "E:/PY.files/无聊小游戏/次数.py", line 44, in <module> ...

Traceback (most recent call last):   File "E:/PY.files/无聊小游戏/次数.py", line 44, in <module>     ...


作者: AragakiYui    时间: 2018-7-13 10:56
Traceback (most recent call last):
  File "E:/PY.files/无聊小游戏/次数.py", line 44, in <module>
    score[name]=[int(gametime),int(mintime),int(totletime)]
TypeError: list indices must be integers or slices, not str
作者: crossin先生    时间: 2018-7-13 13:12
AragakiYui 发表于 2018-7-13 10:56
Traceback (most recent call last):
  File "E:/PY.files/无聊小游戏/次数.py", line 44, in
    score[n ...

这里应该是 scores 吧,你仔细看下,这边是要字典,两个变量名字容易混掉




欢迎光临 Crossin的编程教室 (https://bbs.crossincode.com/) Powered by Discuz! X2.5