社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Game Developement  »  全部回复
回复总数  1
5 年前
回复了 Game Developement 创建的主题 » 在python中按列表存储项

附加值只是暂时的。使用文件I/O进行永久性更改。即。:

def Sign_in():
    email = input("Enter Your Email").strip()
    password = input("Enter your password").strip()
    emails = open('emails.txt','r').readlines()
    passwords = open('passwords.txt','r').readlines()
    if email in emails and password in passwords:
        print("success")
    else : print("invalid")


def Sign_up():
    first_name = input("Enter Your First Name").strip().capitalize()
    last_name = input("Enter Your Last Name").strip().capitalize()
    new_email = input("Enter Your Email").strip()
    new_password = input("Enetr New Password").strip()
    open('fnames.txt','a+').write(first_name+'\n')
    open('lnames.txt','a+').write(first_name+'\n')
    open('emails.txt','a+').write(new_email+'\n')
    open('passwords.txt','a+').write(new_password+'\n')
    print("Sign-In Page")
    Sign_in()

这会将值写入计算机上的文件,然后从这些文件中读取,这样,当您再次运行prorgam时,更改是永久的。