Discuss / Python / 一直获取不到毫秒,快哭了[捂脸]

一直获取不到毫秒,快哭了[捂脸]

Topic source

greatzues

#1 Created at ... [Delete] [Delete and Lock User]

import time,functools

def metric(fn): @functools.wraps(func) def wrapper( args, **kw): x = time.time() fn(args,**kw) y = time.time() cost = round((y-x) 1000 , 2) #获取不到毫秒[smile] print('%s excute in %s ms' %(fn.name,cost)) return fn(args,**kw) return wrapper


  • 1

Reply