请编写一个decorator,能在函数调用的前后打印出'begin call'和'end call'的日志。
def log(func):
def wrapper(*args,**kw):
print ('begin call')
func(*args,**kw)
print ('end call')
return wrapper
@log
def f():
print ('this is a app!')
f()
输出结果:
begin call
this is a app!
end call