zoukankan      html  css  js  c++  java
  • <python>简单的注册和登录1.0

    版本1.0,最基本的注册登录


    '''
    1.注册,将账号和密码分别写在不同的文档里面
    2.登录,分别从账户文档和密码文档进行读取并登录
    '''
    1 #注册
    2 Identity = input("请输入您想要注册的账号:")
    3 Password = input("请输入您想要注册的密码:")
    4 print("恭喜您注册成功")
    5 with open('id_ZC',mode='w',encoding='utf-8') as f1,open('pw_ZC',mode='w',encoding='utf-8') as f2:
    6     f1.write('{}\n'.format(Identity))
    7     f2.write('{}\n'.format(Password))
     1 #登录
     2 i = 0
     3 ID = []
     4 PW = []
     5 while i < 1:
     6     user_id = input("请输入您的账号:")
     7     user_pw = input("请输入您的密码:")
     8     with open('id_ZC',mode='r+',encoding='utf-8') as f1,open('pw_ZC',mode='r+',encoding='utf-8') as f2:
     9         for line in f1:
    10             ID.append(line)
    11             #print(ID)
    12         for line in f2:
    13             PW.append(line)
    14            #print(PW)
    15     #print(ID[0].strip() == ID[0]) #ID[0]后面有换行符需要去掉
    16 
    17     if user_id == ID[0].strip() and user_pw == PW[0].strip():
    18         print("恭喜您登录成功!")
    19   else:print("对不起,登录失败!")
    20     i+=1
     
  • 相关阅读:
    final详解
    静态与非静态
    静态内部类详解
    iso-----genisoimage/md5sum命令用法
    Docker-----版本选择
    Docker-----deepin系统下docker安装registry
    shell高级-----正则表达式
    kolla-ansible-----rally模块
    shell高级-----创建函数
    jenkins入门-----(1)安装、配置
  • 原文地址:https://www.cnblogs.com/shuimohei/p/9614125.html
Copyright © 2011-2022 走看看