当前位置: 移动技术网 > IT编程>脚本编程>Python > python_装饰器之页面登陆验证

python_装饰器之页面登陆验证

2019年06月27日  | 移动技术网IT编程  | 我要评论

姚政近况,第六版人民币图片,混迹倚天

import time


def auth(func):
def wrapper(*args, **kwargs):
username = input('username:').strip()
password = input('password:').strip()
if username == 'admin' and password == '123':
func()
else:
exit()

return wrapper

@auth
def index():
print('index')

@auth
def home():
print('home')

@auth
def bbs():
print('bbs')


# 方法调用
index()
home()
bbs()

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网