DAY7课下作业

  认证功能

    #db.txt(abc:111

        def:222

        ghi:333)

    inp_name=input('请输入你的名字: ').strip()

    inp_pwd=input('请输入你的密码: ').strip()

    with open(r'db.txt',mode='rt',encoding='utf-8') as f:

      for line in f:

        u,p=line.strip('\n').split(':')

        if inp_name == u and inp_pwd == p:

          print('登录成功')

          break

      else:

        print('账号名或者密码错误')

 

posted @ 2018-09-19 19:22  夜夜夜夜夜i  阅读(82)  评论(0编辑  收藏  举报