Discuss / Python / 写个

写个

Topic source

def logswq(text="execute"): res = "" def decorator(func): @functools.wraps(func) def wrapper(args,**kw): print('%s start %s():' % (text, func.name)) res = func(args, **kw) print('%s end %s():' % (text, func.name)) return res return wrapper return decorator

@logswq() def f(): print("2015-08-14")


  • 1

Reply