-5
score=(uName, '=', uCoins)
try:
with open('saveScore.txt', 'rb') as file:
score=pickle.load(file)
except:
score==0
with open('saveScore.txt', 'wb') as file:
pickle.dump(score, file)
这是我的代码,我需要帮助为每个特定的程序执行保存分数,而不必过去任何保存的分数。我似乎无法得到它的工作。在单独执行中保存多个分数
'score == 0'应该做什么?哪里(如果有的话)你在添加“范围”之前将其倾倒出去?你有没有更多的信息比*“我似乎无法得到它的工作”*? – jonrsharpe
然后[RTFM](https://docs.python.org/2/tutorial/datastructures.html#dictionaries)! – jonrsharpe
我不确定,我在其他地方发现了代码并对其进行编辑以适合我的需要。 –