python_[{}]方式_作为临时数据库存储

print('*'*15+'注册用户系统'+'*'*15)
user = {}
list1 = []
while True:
    username = input('请输入用户名:')
    passwd = input('请输入密码:')
    again_passwd = input('请输入密码:')
    if passwd != again_passwd:
        print('两次输入的密码不一致,请重新输入。')
        continue
    email = input('请输入邮箱:')
    telephone = input('请输入电话:')
    #将每次输入的内容存储到字典中。
    user['username'] = username
    user['passwd'] = passwd
    user['email'] = email
    user['telephone'] = telephone
    list1.append(user)
    answer = input('是否继续输入:(y/n)')
    if answer != 'y':
        break
print (list1)

猜你喜欢

转载自www.cnblogs.com/zl001/p/12058623.html