美好的一天!即使没有定义它,为什么python会识别我的对象?
我可以有别人的上一本书,我在读书,并努力学习Python样品的帮助?
对于下面所示的代码。我从来没有定义“each_score”,为什么这个“each_score”被Python识别并且运行正常?
scores={}
result_f=open("py score.txt")
for line in result_f:
(name,score)=line.split()
scores[score]=name
result_f.close()
print("The top scores were:")
for each_score in scores.keys():
print('surfer '+scores[each_score]+' scored '+each_score)
的方式,文本文件的内容很简单,如下:
Johnny 8.65
Juan 9.12
Joseph 8.45
Stacey 7.81
Aideen 8.05
Zack 7.21
Aaron 8.31
哇,感谢您的回复这么快! –
请问这本书是从哪里来的? –
我希望两个冲浪者不会得到完全相同的分数。 – Droogans