Python Decorator with Parameters
Add parameters to Python decorator
import functoolsdef decorate(content):def real_decorator(origin_func):@functools.wraps(origin_func)def new_func(x, y):print('You said ' + str(content))print(x)origin_func(x, y)return new_funcreturn real_decorator@decorate(2021)def sayHello(x, y):return x+ysayHello(1, 2)