# -*- coding:utf-8 -*- #Author:zhou count = 0 while count < 3: username = input("Username:") password = input('Password:') f2 = open('lock.txt', 'r') for line2 in f2: if username == line2.strip(): print("该账号已经被锁定,请联系管理员") exit() f2.close() f1 = open('login.txt', 'r') for line1 in f1: if username == line1.split(":")[0].strip(): if password == line1.split(":")[1].strip(): print("Welcome User : %s" % username) exit() else: print('密码错误') f1.close() with open('login.txt', 'r') as f: rflag = 0 for l in f: if username == l.split(":")[0]: rflag = 1 if rflag != 1: exit('\033[41;1m账号错误\033[0m') count +=1 else: print("输入信息错误三次,账号已锁定") f3 = open('lock.txt', 'a') f3.write(username+'\n') f3.close()
登陆系统-3次自动锁定
最新推荐文章于 2019-06-02 21:30:25 发布