- 封装成python函数
def login(user,pwd):
store={'root':123}
if store.get(user) != None:
if pwd==store.get(user):
print('登陆成功!')
return True
else:
print('密码错误!')
return False
else:
print('用户未注册!')
return False
while True:
user = input("请输出用户名:")
pwd = int(input("请输入密码:"))
ret = login(user,pwd)
if ret:
break
else:
continue