PYTHON装饰器


def zhuangshi(func):
    def hello1(*args,**kwargs):
        print(kwargs)
        func(*args,**kwargs)
    return hello1

@zhuangshi
def hello(name,*args,**kwargs):
    print('hello')



hello("hello",string=1)

 

# def zhuangshi(func):
#     def hello1():
#         print('nihao')
#     func()
#     return hello1
# 
# @zhuangshi
def hello():
    print('hello')


hello()

包含闭包的知识

posted on 2019-11-04 10:31  土豆爸  阅读(112)  评论(0编辑  收藏  举报

导航