username = [] password = [] f1 = open("username_list.txt") for name in f1.readline(): username.append(name.strip('\n')) f1.close() f2 = open('password_list.txt') for pwd in f2.readline(): for pwd in f2.readline(): f2.close() name = input("please input username:") times = 0 while name in username: f3 = open('lock_list.txt') lock = [] for line in f3.readline(): lock.append(line.strip('\n')) f3.close() if name in lock: print("you count is locking") break pwd = input("please input you password:") if pwd in password: print("welcome you login the system!") break else: print("your password is wrong") times += 1 if times ==3: print("your account is locked") f = open('lock_list.txt','a') f.write('%s\n'%name) break else: print("your username is wrong")