I've created a function which creates a new password. But I want a function to store it in a text file from which it will be called when the program is started.

Also how do I make an edit or delete password function? As the password will have to be called from the file to edit and store back,I do not know how to do create it.

def new_password():
    password = input ("Enter a password: ")
    verify = input ("Re-enter your password: ")
    while password != verify:
        print("Enter your password correctly.")
        password = input ("Enter a password. ")
        verify = input ("Re-enter yourpassword: ")
    print("Password created")
    return password