zoukankan      html  css  js  c++  java
  • 注册登录

    登陆注册:
    要求:①注册②注册的用户名和密码写入到文件③登录时从文件取出用户名和密码来匹配输入的用户名和密码
              ④若匹配失败,有三次机会

    username = input('请输入注册的用户名:')
    password = input('请输入注册的密码:')
    with open('登陆注册信息文件',mode = 'w',encoding = 'UTF-8') as f:
        f.write('{}
    {}'.format(username,password))
        print('恭喜你,注册成功!')
    lis = []
    i = 0
    while i < 3:
        i += 1
        uname = input('请输入用户名:')
        pword = input('请输入密码:')
        with open('登陆注册信息文件', mode='r', encoding='UTF-8') as f1:
            for line in f1:
                lis.append(line)
        if  uname == lis[0].strip() and pword == lis[1]:
            print('登陆成功')
        else:
            print('账号或者密码错误')
  • 相关阅读:
    第四次
    jsp
    2021.3.4
    第八次作业
    第七次作业
    第六周作业
    第五周作业
    第四周
    第四次jsp作业
    第二次作业
  • 原文地址:https://www.cnblogs.com/twinkle-/p/10486340.html
Copyright © 2011-2022 走看看