摘要:
def timer(f): #闭包,这里闭包的不是变量,而是形参f def inner(): print("执行函数前") f() print("执行函数后") return inner@timerdef func(): print('hello ,装饰器') time.sleep(0.1)f1=f 阅读全文
摘要:
# 指定数的阶乘def sum(n): if n==1: return n else: return n*sum(n-1)num=sum(5)print(num) # 阶乘递归求和def total_sum(m): total=0 for i in range(1,m+1): def sum(n): 阅读全文