Python 装饰器Hawtian Wang published on 2015-08-21 included in category Tech给函数添加一个包装层以添加额外的处理部分,我们就可以使用装饰器这种方法。 0.0.0.0.0.1 定义一个装饰器: 1 2 3 4 5 6 7 8 9 10 import time def timethis(func): def wrapper(*args, **kwargs): start = time.time() result = func(*args, **kwargs) end