zoukankan      html  css  js  c++  java
  • 2018.09.20python作业

    用户登入,永久锁定锁定,3次黑名单
    name=input('please your name: ')
    # pwd=input('please your password: ')
    with open('黑名单.txt',mode='rt',encoding='utf-8') as a :##

    for msg in a:

    if name==msg.strip(' '):
    print('该用户已经被锁定')
    break

    with open("用户数据库.txt",mode='rt',encoding='utf-8') as b:
    for info in b:
    n,p=info.strip(' ').split(':')
    if name == n:
    count=0
    while True:
    pwd = input('please your password: ')
    if pwd==p:
    print("login successful")
    break
    if count==2:
    print('用户锁定')

    with open('黑名单.txt',mode='at',encoding='utf-8')as x:
    x.write(name)
    break
    else:
    print("密码错误")
    count+=1



    else:
    print("用户不存在")
  • 相关阅读:
    面向对象基础
    JS操作属性和样式
    表单验证
    form标签
    Dreamweaver网页设计代码大全
    最差项目展示
    CSS样式表
    while循环 do while循环 switch
    for循环
    穷举法
  • 原文地址:https://www.cnblogs.com/hello-yuanjing/p/9684028.html
Copyright © 2011-2022 走看看