1 #IO操作 2 #模拟账号登录 3 4 data = [] #0=userName 1=password 5 6 obj = open("login.txt","r") 7 for line in obj: 8 data.append(line.strip("\n")) 9 obj.close() 10 11 12 while True: 13 print("---------") 14 print("| 登录 |") 15 print("---------") 16 userName = input("input your userName: ") 17 if(userName == data[0]): 18 password = input("input your password: ") 19 if(password == data[1]): 20 print("登录成功") 21 break 22 else: 23 print("密码错误") 24 else: 25 print("账号错误")
时间: 2024-11-10 03:28:46