I am currently creating a login system in python. The problem I am facing is I do not know how to detect if the username is taken based on a text file.
I have tried using while loops and for loops, but nothing worked. My only guess is that I have to use lists in this scenario, but I do not know how to implement it.
Any help would be greatly appreciated.
Below is the code I currently have
username = input("Please enter a username: ")
password = input("Now please enter a password: ")
customer_information = open("login.txt","a")
customer_information.write(username)
customer_information.write(" ")
customer_information.write(password)
customer_information.write("\n")
customer_information.close()
print("User was successfully registered")
customer_login() #This command will direct the guests to the login interface