text_file = open("high_score.txt", "w")
text_file.writelines([player_name, "'s score is: ", scores])
text_file.close()
text_file = open("high_score.txt", "r")
print(text_file.read())
text_file.close()
我正在尝试将高分写入.txt文件。但每次它重新写入文件。琐事游戏 - 我试图写高分.txt文件
如何防止这种情况发生?