zoukankan      html  css  js  c++  java
  • 作业一:登陆接口

     1 #作业:登陆接口
     2 user=['test','test1','test2','test3']
     3 password=['test','1test','2test','3test']
     4 count=0
     5 while True:
     6     if count > 2:
     7         print('''
     8   你操作太频繁,请稍后再试!
     9         ''')
    10         break
    11     name = input('your name: ')
    12     pwd = input('your password: ')
    13     if  not name in user:
    14         print('用户名不存在')
    15         continue
    16     id=user.index(name)
    17     if  pwd == password[id]:
    18         print('欢迎登陆!')
    19         break
    20     else:
    21         print('用户名或者密码错误!请重试')
    22         count+=1
    23 #进阶:
    24 user=['test','test1','test2','test3']
    25 password=['test','1test','2test','3test']
    26 count=0
    27 while True:
    28     name = input('your name: ')
    29     pwd = input('your password: ')
    30     with open('denylogin.txt', 'r')  as file:
    31         denylist = file.read()
    32         if name in denylist:
    33             print('你的账户已经锁定,不能登陆,请联系管理员!')
    34             break
    35     if  not name in user:
    36         print('用户名不存在')
    37         continue
    38     id=user.index(name)
    39     if  pwd == password[id]:
    40         print('欢迎登陆!')
    41         break
    42     else:
    43         print('用户名或者密码错误!请重试')
    44         count+=1
    45     if count > 2:
    46         print('''你操作太频繁,账户已经锁定''')
    47         with open('denylogin.txt','a') as  file :
    48             file.write('%s' %name+'\n')
    49             break
  • 相关阅读:
    作用域面试题
    js··BOM 浏览器对象模型
    js···DOM2动态创建节点
    js ·节点的知识点
    js·逻辑运算
    js···元素的属性
    什么是函数封装。
    hive 历史拉链表的处理
    [转]实现Hive数据同步更新的shell脚本
    python 3 过滤股票
  • 原文地址:https://www.cnblogs.com/lincappu/p/8143866.html
Copyright © 2011-2022 走看看