def zsq(fun01):
def fun(*args,**kwargs):
print('验证')
fun01(*args,**kwargs)
return fun
@zsq
def deposit(money):
print('存%d在咯' % money)
@zsq
def withdraw(login_id,pwd):
print('取钱咯',login_id,pwd)
deposit(111)
withdraw(123,250)
def 计算运行时间(fun01):
def fun(*args,**kwargs):
begin = time.time()
result = fun01(*args,**kwargs)
end = time.time()
print("执行了%s" %(end-begin))
return result
return fun
@计算运行时间
def fun25():
time.sleep(2)
print('fun25执行完毕')
@计算运行时间
def fun26(a):
time.sleep(1)
print('fun26执行完毕,参数:',a)
fun25()
fun26(1)
|