立即学习:https://edu.csdn.net/course/play/27093/354197?utm_source=blogtoedu
flask装饰器的作用是抽离出与功能无关的大量雷同代码,常用与写入日志等的作用
如
from flask import Flask app = Flask(__name__) def mailtitle(func): def inner(): print("登录邮箱") func() return inner #执行mailui()前都会执行mailtitle() @mailtitle def mailui(): print("邮箱界面") mailui() if __name__ == '__main__': app.run()
来源:CSDN
作者:Felix_Wu_2017
链接:https://blog.csdn.net/Felix_Wu_2017/article/details/104613589