I am making a pretend login system as a project. When the in_file variable is in the file I want it to print you are logged in. However, it doesn't do this since it doesn't think that the in_file variable is in the file. How do I fix this?
sample of the file
username/password
Matthew/06112004
James/Nemo20044!
account = input('do you want to sign up or login ? ')
file = open('login.txt', 'a+')
def log_in(filename):
logging_in = True
while logging_in:
username = input('Username: ')
password = input('Password: ')
in_file = f'{username}/{password}'
if in_file in filename.read():
print('you are logged in')
logging_in = False
if in_file not in filename.read():
print('user name or password are incorrect')
if account == 'login':
log_in(file)