首页 > 代码库 > python3.5------用户的三次验证
python3.5------用户的三次验证
笔者QQ: 360212316
逻辑图
代码
#/usr/bin/python # -*- coding: utf-8 -*- lock = open("black_user_list.txt", ‘a‘, encoding=‘utf-8‘) lock.write("\n") user_list = open("userlist.txt", ‘w+‘, encoding=‘utf-8‘) user_list.write("zhangsan\n") user_list.write("lisi\n") user_list.close() user_list = open("userlist.txt", ‘r‘, encoding=‘utf-8‘) white_username = user_list.read().strip() user_list.close() lock = open("black_user_list.txt", ‘r+‘, encoding=‘utf-8‘) lock_username = lock.read().strip() while True: username = input("username:") if username in lock_username: print("\033[31;1m %s Account lockout \033[0m" % username) break elif username in white_username: for i in range(2, -1, -1): password = input("password:") if password == ‘abc123‘: print("Welcome to log on %s" % username) break else: print("\033[31;1mPassword remaining: \033[0m %s" % i) if i == 0: print("\033[31;1m %s Account lockout \033[0m" % username) lock.write("\n") lock.write(username) lock.close() exit() else: print("Account does not exist")
python3.5------用户的三次验证
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。