编写登录认证程序

发布时间:2020-07-16 11:44:35 作者:swk8094
来源:网络 阅读:224

要求:

编写登录认证程序

# -*- coding=utf-8 -*-
user = {'alex':'qwer1234','lilei':'asdf1234','han×××':'zxcv1234','lucy':'qwer1234'}

loop = True
while loop:
    count = 0
    f = open('blacklist.txt', mode='r', encoding='utf-8')
    blacklist = f.read()
    f.close()
    input_user = input('please input your  username:').strip()

    
    if not input_user : continue
    if input_user in blacklist:
        print('sorry,your username is banned')
        continue
    for i in user:
        input_pw = input('please input your password:').strip()
        if input_user not in user:
            print('sorry,your username is error')
        elif user[input_user] == input_pw:
            print('wellcome',input_user)
            loop = False
            break
        else:
            count += 1
            print('sorry,your password is error,you have %s times'%(3-count))
            if count > 2:
                f = open('blacklist.txt','a',encoding='utf-8')
                f.write('%s '%input_user )
                print('sorry,your username is banned')
                f.close()
                break


推荐阅读:
  1. 建立mongodb的登录认证功能
  2. 使用tkinter编写登录窗口

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

老男孩 编写 登录程序

上一篇:mysql不能远程访问怎么办

下一篇:什么是java的面向对象

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》