摘要: filter函数 过滤函数:对一组数据进行过滤,符合条件的数据会生成一个新的列表并返回 1 # 对一个列表进行过滤,偶数组成一个新列表 2 3 def isEcen(a): 4 return a % 2 == 0 5 6 l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 7 r = filter(isEcen, l) 8 print(type(r)) ... 阅读全文
posted @ 2018-07-28 23:20 Burtit 阅读(194) 评论(0) 推荐(0) 编辑