我想要去除從文件中得分,在一個有序列表,我可以打印出第1,第2和第3個地方安排他們,這裏是我的代碼:使得從一個txt列表數組
scores = []
result_f = open("results.txt")
for line in result_f:
(name, score) = line.split()
scores.append = (float(score))
result_f.close()
print("The highest scores were: ")
print(score[0])
print(score[1])
print(score[2])
控制檯誤差蟒給出爲:
文件 「C:\ Python34 \ surfingscores.py」,第5行,在 scores.append =(浮動(評分)) AttributeError的: '列表' 對象屬性 '追加'是隻讀的