打印函数运行时间的装饰器
            时间:2017-05-29 13:24:29  
            收藏:0  
            阅读:319
        
        
        1 import time 2 3 def timethis(func): 4 """ 5 测试函数运行花费时间的装饰器 6 """ 7 def wrapper(*args, **kwargs): 8 start = time.time() 9 result = func(*args, **kwargs) 10 end = time.time() 11 print("函数 %s 运行时间: %s" % func.__name__, end - start) 12 return result 13 return wrapper
原文:http://www.cnblogs.com/tingshuo123/p/6917769.html
            评论(0)
        
        
        