• python之登录小程序


     1 # 登录操作
     2 PassWord_list = []
     3 Reset_pw = '*#*#'
     4 def account_login():
     5     if PassWord_list == []:
     6        PassWord = input("请设置初始密码:")
     7        if PassWord.isalnum():
     8            PassWord_list.append(PassWord)
     9            account_login()
    10        else:
    11            print("密码只能是输入或字母,请重新输入")
    12            account_login()
    13     else:
    14         # print(PassWord_list)
    15         num = 3
    16         while num > 0:
    17             password = input('请输入您的登录密码: ')
    18             correct_password = password == PassWord_list[-1]
    19             reset_password = password == Reset_pw
    20             if correct_password:
    21                 print("登录成功")
    22                 quit()
    23             elif reset_password:
    24                 new_password = input('请输入要重置的密码: ')
    25                 if new_password.isalnum():
    26                      PassWord_list.append(new_password)
    27                 else:
    28                     print("密码只能是输入或字母,请重新输入")
    29                     account_login()
    30                 print('密码已经重置成功,请输入重置的密码登录')
    31                 account_login()
    32             else:
    33                 print("您输入的密码错误,请再次输入或输入'*#*#'重置密码")
    34                 num = num -1
    35                 print(num,'time left')
    36         print("输入次数过多")
    37 account_login()
  • 相关阅读:
    qt install (1)
    learning rewind func
    learning strrchr func
    learning memchr func
    git lfs setpu(4)
    大端与小端
    git branch/meger step(3)
    git log/show/HEAD step(2)
    调用外部EXE文件
    获取计算机上的所有进程
  • 原文地址:https://www.cnblogs.com/xuelei-0728/p/6229184.html
Copyright © 2020-2023  润新知