标签:python
#/usr/bin/env python3
import time
def outer(key):
def timer(func):
def wrapper(*args,**kwargs):
print(key)
s=time.time()
res=func(*args,**kwargs)
e=time.time()
print(e-s)
return res
return wrapper
return timer
@outer(‘dec info‘)
def do(a):
time.sleep(1)
print(a)
return a+1
标签:python
原文地址:http://blog.51cto.com/13606158/2084950