如何在代码中存储日志和密码的数据?

2024-09-24 20:25:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我想存储为日志和密码列表输入的数据

我什么也没试过,因为我不知道怎么做

logs = []
passwords=[]
def register():
    log = input("name:")
    password = input("password:")
    logs.append(log)
    passwords.append(password)
def acess():
    checklog = input("name:")
    checkpassword= input("password:")
    if logs.index(checklog) == passwords.index(checkpassword):
        print("ok")
    else:
        print("fail in verification")

我希望下次重新打开程序时,我先前插入的日志和密码已经注册


Tags: 数据namelog密码列表inputindexdef