Python‎ > ‎itertools‎ > ‎

itertools.dropwhile()


Definition
Drop items from the iterable while predicate(item) is true. Afterwards, return every element until the iterable is exhausted.

Syntax
dropwhile(predicate, iterable) --> dropwhile object

Parameters
predicate
iterable

Examples
The equal to:
 def function1(x):
x>5
list(itertools.dropwhile(function1, [1,2,3,4]))
>>>
[1, 2, 3, 4]
>>>

Comments