标签:后台管理 false 输入密码 order style current and change lse
LOGIN_USER = {"is_login": False} def outer(func): def inner(*args, **kwargs): if LOGIN_USER[‘is_login‘]: r = func() return r else: print("请登陆") return inner @outer def order(): print("欢迎 %s 登陆") @outer def order(): print("欢迎 %s 登陆") @outer def changepwd(): print("欢迎 %s 登陆") @outer def manager(): print("欢迎 %s 登陆") def login(user, pwd): if user == "spencer" and pwd == "123": LOGIN_USER["is_login"] = True LOGIN_USER["current_user"] = user manager() def main(): while True: ipt = input = "1:后台管理;2:登陆" if ipt == "1": manager() elif ipt == "2": username = input("请输入账号:") pwd = input("请输入密码:") login(username, pwd)
标签:后台管理 false 输入密码 order style current and change lse
原文地址:https://www.cnblogs.com/spencersun/p/9205427.html