过滤功能

过滤器需要一个函数和一个集合。它返回函数返回 True 的每个项的集合。

arr=[1,2,3,4,5,6]
[i for i in filter(lambda x:x>4,arr)]    # outputs[5,6]