Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我编写了一个小型 Python Snake 游戏,我想记录我的分数以在图表中可视化它们。有一个问题:它用新分数覆盖旧分数,而不是在新行中添加它,这是我的代码:
with open("results.txt", mode="w+") as result_list: result_list.write(f"{self.high_score}\n")
我也尝试过,writelines但没有帮助。有人可以告诉我我的代码有什么问题,在此先感谢!
writelines