Python text file

Hello, I’m a beginner I want to create a login and register system using a text file I have don’t this bit I don’t know how can I add it with my text file to check if the user id and password are matching or not and for register I want it that everyone registered will be added as well.

with open(‘students.txt’) as f:
contents =
users = {}
status = “”

def displayMenu():
status = input("Do You have an account? y/n? Press q to quit: ")
if status == “y”:
elif status == “n”:

def newUser():
createLogin = input("Please Enter your student ID: ")

if createLogin in users:
    print("\nLogin name already exist!\n")
    createPassw = input("Create password: ")
    users[createLogin] = createPassw
    print("\nUser created\n")

def oldUser():
login = input("Enter Student ID: ")
passw = input("Enter password: ")

if login in users and users[login] == passw:
    print("\nLogin successful!\n")
    print("\nUser doesn't exist or wrong password!\n")

while status != “q”: