python 輸出時間裝飾器
import time
def echoRuntime(func):
def wrapper(*args, **kwargs):
startTime = time.time()
func(*args, **kwargs)
endTime = time.time()
msecs = (endTime - startTime)
print(func.__name__+" running time is %.2f s" %msecs)
return wrapper