I am writing a simple script to add users and a password to a text file. I managed to figure it out but ran into the unexpected problem of my file being wiped clean each time with only my recent add in the text file. Here is the code
from getpass import getpass
from time import sleep
def Add_User():
Database = open("C:\\Users\Dark Ariel7\\Desktop\\USB BAckup\\Scripts\\Database.txt", "w", encoding='utf-8')
Username = input("Username: ")
Password = getpass(str("Password: "))
Add_User = ",".join((Username,Password))
Database.write(Add_User)
Add_User()
I also appreciate extra feedback.