def log(func): def wrapper(*args,**kw): print('call bigin %s():'%func.__name__) func(*args,**kw) print('call end %s():'%func.__name__) return wrapper @log def now(): print('2016') now()
结果: call bigin now(): 2016 call end now():
跟我一开始写的一样,其实有问题
Sign in to make a reply
穿人字拖的贝吉塔
结果: call bigin now(): 2016 call end now():