摘要: 生成式是一种独特的数据处理方式,可以从一个数据序列构建另一个新的数据序列的结构体。 比如你要生成一个[ 1x1, 2x2, 3x3, ..., 10x10 ] 的列表,不用生成式的方法: L = [] for x in range(1,11): L.append(x) print(L) [1, 4, 阅读全文
posted @ 2022-06-23 23:09 zed99 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 装饰器 顾名思义 就是一个用来修改其他函数的功能的函数。 def new_decorator(a_func): #装饰器函数 def wrapTheFunction(): print("I am doing some boring work before executing a_func()") a 阅读全文
posted @ 2022-06-23 15:49 zed99 阅读(9) 评论(0) 推荐(0) 编辑