ここに問題があります-私はピクルスにしようとしています、そして次にヒスコアをピクルスに外します。pickle.loadを使用すると、Pythonは、自分が持っている「Pickle」というファイルを読み込もうとしていると考えているようです。コードは次のとおりです。
def recieve_hiscores():
hiscores_file = open("hiscores_file.dat", "rb")
for i in hiscores_file:
hiscores = pickle.load(hiscores_file)
hiscores = str(hiscores)
print(hiscores)
ピクルスコードは次のとおりです。
def send_hiscores(score):
hiscores_file = open("hiscores_file.dat", "ab")
pickle.dump(score, hiscores_file)
hiscores_file.close()
そして、ここにエラーメッセージがあります:
Traceback (most recent call last):
File "C:\Python31\My Updated Trivia Challenge.py", line 106, in <module>
main()
File "C:\Python31\My Updated Trivia Challenge.py", line 104, in main
recieve_hiscores()
File "C:\Python31\My Updated Trivia Challenge.py", line 56, in recieve_hiscores
hiscores = pickle.load(hiscores_file)
File "C:\Python31\lib\pickle.py", line 1365, in load
encoding=encoding, errors=errors).load()
EOFError
他に間違いがあったとしても心配しないでください。私はまだ学んでいますが、これを解決することはできません。