美文网首页
python_装饰器

python_装饰器

作者: 季花鱼_邹亚 | 来源:发表于2019-06-05 12:39 被阅读0次

    ```python

    def all(func, *argv):

    def run():

    print('i am run 1')

    func()

    print('i am run 2')

    return run

    @all

    def one(a = 'i am one'):

    print(a)

    @all

    def two(a = 'i am two'):

    print(a)

    @all

    def thr(a = 'i am thr'):

    print(a)

    one()

    two()

    thr()

    ```

    相关文章

      网友评论

          本文标题:python_装饰器

          本文链接:https://www.haomeiwen.com/subject/lxpbqftx.html