码迷,mamicode.com
首页 > 编程语言 > 详细

python filter 函数

时间:2017-05-23 13:11:43      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:span   ret   div   turn   return   pytho   filter   判断   bsp   

filter 函数,是用来过滤一个序列使用的。接收两个参数(函数, 序列)

例如判断是否为偶数

1 def num(a)
2     if a%2==0
3         return a
4 
5 filter(num,1,2,3,4,5,6,7,8,910)

 

python filter 函数

标签:span   ret   div   turn   return   pytho   filter   判断   bsp   

原文地址:http://www.cnblogs.com/pxfb/p/6893437.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!