Ok, so I have this code that I have written:
Authorised = False
while not Authorised:
useri = input("Enter your username: ")
passi = input("Enter your password: ")
users = open("Users.txt", "r")
EndOfFile = False
while not EndOfFile:
userr = ""
passr = ""
line = users.readline()
if line == "":
EndOfFile = True
continue
splitlines = line.split(",")
userr = splitlines[0]
passr = splitlines[1]
if useri == userr:
if passi == passr:
username = userr
EndOfFile = True
Authorised = True
users.close()
else:
print("Wrong Password")
EndOfFile = True
users.close()
if userr == "":
print("Invalid username")
Users.txt:
A,B,
B,A,
For some reason when I run it it says that the password is wrong. I’m not sure why. If anybody could explain this to me it would be greatly appreciated.
Thanks
AandB?AandBEnter your username: AEnter your password: BWrong PasswordEnter your username: