学习笔记(09):21天通关Python(仅视频课)-案例实操:函数装饰器应用

立即学习:https://edu.csdn.net/course/play/24797/282189?utm_source=blogtoedu

def test(fn):
    print('test函数')
    return 'test函数22222'


def test1(fn):
    print('test1函数')

    def test111(*args):
        print('in')
        fn(*args)
        print('out')

    return test111


@test
def test2():
    print('test2函数')


print(test2)
print('_' * 30)


@test1
def test3(a, b):
    print('test2函数')
    print('No.=' , a)
    print('No.=' , b)


test3(6,7)

print('_' * 30)
发布了25 篇原创文章 · 获赞 4 · 访问量 607

猜你喜欢

转载自blog.csdn.net/happyk213/article/details/105141774