Discuss / Python / 小结1

小结1

Topic source

青铜神裔

#1 Created at ... [Delete] [Delete and Lock User]
  • 函数调用的前后打印出'begin call'和'end call'的日志

    import functools def log(func):

    @functools.wraps(func)
    def wrapper(*args, **kw):
        print('begin call')
        func(*args, **kw)
        print('end call')
    return wrapper
    

  • 1

Reply