这是我的代码,不知道为什么我得到错误。错误是" TypeError:列表索引必须是整数或切片,而不是str"
def HistoryHard():
file = open('HistoryHard.txt','r')
for line in file:
detail = line.split(',')
print(detail[0])
detail[1] = detail[1].strip('\n')
Selection = input('1:Yeas\n2:No\n')
if Selection == detail[1].strip(): #problem is this line
print('correct')
else:
print('incorrect')