Python dropwhile Iterator

Python dropwhile(condition, data) iterator drops data based on condition.

>>> from itertools import *
>>> data = [1,4,6,2,34,9]
>>> x = dropwhile(lambda x: x<10,data) #drop till the elements >=10
>>> for i in x:
>>> print(i)
34
9






















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