Iteration Classes
itertools.dropwhile()
Discard the initial run of truthy predicate results, then yield the first false item and all remaining items without further predicate tests.
Formal Syntax & Structure
python syntaxpython
itertools.dropwhile(predicate, iterable, /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| predicate | callable | Predicate applied to each input value. |
| iterable | iterable | Input values, consumed as needed. |
Return Value
iterator
The iterator result described above.
Working Example
Example Snippetpython
import itertoolsprint(list(itertools.dropwhile(lambda x:x<3,[1,3,2,4])))