zoukankan      html  css  js  c++  java
  • python3.5------用户的三次验证

    笔者QQ: 360212316

    逻辑图

    三次验证

    代码

    #/usr/bin/python
    # -*- coding: utf-8 -*-
    
    lock = open("black_user_list.txt", 'a', encoding='utf-8')
    lock.write("
    ")
    user_list = open("userlist.txt", 'w+', encoding='utf-8')
    user_list.write("zhangsan
    ")
    user_list.write("lisi
    ")
    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("33[31;1m %s Account lockout 33[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("33[31;1mPassword remaining: 33[0m %s" % i)
                    if i == 0:
                        print("33[31;1m %s Account lockout 33[0m" % username)
                        lock.write("
    ")
                        lock.write(username)
                        lock.close()
                        exit()
        else:
            print("Account does not exist")
  • 相关阅读:
    校验参考相关备份
    API接口设计
    redis 基础配置
    Apollo 统一配置中心
    http返回状态码记录
    ngnix实战
    OAuth2三方授权
    OAuth2授权协议记录
    KMP算法
    分治法
  • 原文地址:https://www.cnblogs.com/alber/p/5987825.html
Copyright © 2011-2022 走看看