2021-03-21

print(" 用户的创建")
def userscreate():
print(‘注册’.center(50,’*’))
print(’*开头为必填项’)
name = input(’*Enter a name:’)
if not name in users:
passwd = input(’*Enter a password:’)
gender = input("*0-‘女’,1-‘男’😊
age = input(‘enter your age:’)
email = input(“输入邮箱:”)
if not email:
email = None
users[custom] = {‘name’: name, ‘passwd’: passwd, ‘age’: age, ‘gender’: gender, ‘email’: email}
print(“用户创建成功”)
else:
print(“用户已经存在”)

def userslogin():
print(“登录”.center(100,’*’))
timeout = 0
while timeout < 3:
name = input(“输入用户名:”)
if not name in users:
print(“用户不存在”)
timeout = timeout + 1
break
else:
passwd = input(‘输入密码:’)
if passwd == users[name][‘passwd’]:
print(‘登录成功’)
break
else:
print(‘密码错误,请重新输入:’)
timeout = timeout + 1
else:
print(‘输入超时’)

def userlogoff():
print(“注销”.center(50, ‘*’))
name = input(‘输入要注销的用户名:’)
if name in users:
users.pop(name)
print(’%s 已注销’ %name)
else:
print(‘未注册的用户’)

def usermessages():
for i,j in users,item():
print(’%s %s \n’ %(i,j))
info = ‘’’
用户登录管理系统
1.注册新用户
2.用户登录
3.用户注销
4.用户信息查询
5.退出系统
**************************’’’
users = {‘root’: {‘name’: ‘root’, ‘passwd’: ‘root’, ‘gender’: ‘1’, ‘email’: ‘’, ‘age’: 22}, }
while 1:
print(info)
choice = input()
if choice == 1:
userscreate()
elif choice == 2:
userslogin()
elif choice == 3:
userlogoff()
elif choice == 4:
usermessages()
elif choice == 5:
exit()
else:
print(“重新输入”)
users = {‘root’: {‘name’: ‘root’, ‘passwd’: ‘root’, ‘gender’: ‘1’, ‘email’: ‘’, ‘age’: 22}, }
一个关于用户登录的系统,为什么一直报错?求大佬帮忙指正

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值