Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 350 Bytes

49.md

File metadata and controls

18 lines (13 loc) · 350 Bytes
@author jackzhenguo
@desc 
@date 2019/3/4

49 过滤器  

在函数中设定过滤条件,迭代元素,保留返回值为True的元素:

In [1]: fil = filter(lambda x: x>10,[1,11,2,45,7,6,13])

In [2]: list(fil)
Out[2]: [11, 45, 13]
[上一个例子](48.md) [下一个例子](50.md)