How to write to a file without overwriting current contents? [duplicate] April 15, 2023 by Tarik Instead of "w" use "a" (append) mode with open function: with open("games.txt", "a") as text_file: