• 第二周周末作业


    # import time
    # count=0
    # while count<3:
    # inp_name=input('请输入用户名:')
    # inp_pwd=input('请输入密码:')
    # with open("user.txt",mode="rt",encoding="utf-8") as f,open("lock.txt",mode="rt",encoding="utf-8") as f2:
    # for line in f:
    # username,password=line.strip().split(':')
    # for lock in f2:
    # res=lock.strip()
    # if inp_name==res:
    # print('{}该账户已锁定'.format(res))
    # time.sleep(5)
    # elif inp_name==username and inp_pwd==password:
    # print('登陆成功')
    # break
    # else:
    # print('登录失败')
    # count+=1
    # if count==3:
    # with open("lock.txt",mode="at",encoding="utf-8") as f2:
    # res=f2.write(inp_name)
    # time.sleep(5)
    # count=0


    # 2.2:编写程序实现用户注册后,可以登录,
    # 提示:
    while True:
    msg = """
    0 退出
    1 登录
    2 注册
    """
    print(msg)
    cmd = input('请输入命令编号>>: ').strip()
    if not cmd.isdigit():
    print('必须输入命令编号的数字,傻叉')
    continue

    if cmd == '0':
    break
    elif cmd == '1':
    # 登录功能代码(附加:可以把之前的循环嵌套,三次输错退出引入过来)
    pass
    elif cmd == '2':
    # 注册功能代码
    pass
    else:
    print('输入的命令不存在')
  • 相关阅读:
    模块3 re + 正则表达式
    模块2
    模块1
    super
    MRO,C3算法
    日志,固定格式
    异常处理,MD5
    类的约束
    反射
    异常处理MR5
  • 原文地址:https://www.cnblogs.com/haliluyafeng/p/12501878.html
Copyright © 2020-2023  润新知