I'm working on a little side project and I have a small issue currently. The user enters their name through a input
, and then it is saved to a text file. Everything works fine but when it comes to making a new line with \n
to separate the names, it replaces the previous text in the text file. I can't seem to find the reason why online. Any help would be appreciated!
name = input("Name: "))
with open("names.txt", "w") as w:
w.write(name + "\n")