内置函数filter

内置函数filter:返回符合要求数值

def f1(x):
return x>22
ret=filter(f1,[11,22,33,44,55])
print(type(ret))
for i in ret:
print(i)
temp=filter(lambda x:x>22,[11,22,33,44,55])
for v in temp:
print(v)
posted @ 2017-10-26 21:18  python学到老  阅读(153)  评论(0)    收藏  举报