Python filter Iterator

Python filter(contintion,data) iterator filters data based on condition.

>>> from itertools import *
>>> data = [2,6,9,3,1,5]
>>> x = filter(lambda x: x%2, data)
>>> for i in x: print (i)
9
3
1
5






















endmemo.com © 2024  | Terms of Use | Privacy | Home