python 带参数装饰器
2021-08-06 python 1424
def say_hello(country):
def wrapper(func):
def deco(*args, **kwargs):
print(country)
func(*args, **kwargs)
return deco
return wrapper
@say_hello('china')
def test():
print("hello test")
test()返回结果:
china
hello test
很赞哦! (0)
相关文章
文章评论
-
-
-
0条评论