def metric(func): @functools.wraps(func) def wrapper(args, **kw): t1 = time.time() t = func(args, **kw) t2 = time.time() print('the outcome is %d' %t) print('the excution time is %.4f' % (t2-t1)) return return wrapper
Sign in to make a reply
王佳琦Pioneer
def metric(func): @functools.wraps(func) def wrapper(args, **kw): t1 = time.time() t = func(args, **kw) t2 = time.time() print('the outcome is %d' %t) print('the excution time is %.4f' % (t2-t1)) return return wrapper