Tutorial by Examples: dropwhile

itertools.dropwhile enables you to take items from a sequence after a condition first becomes False. def is_even(x): return x % 2 == 0 lst = [0, 2, 4, 12, 18, 13, 14, 22, 23, 44] result = list(itertools.dropwhile(is_even, lst)) print(result) This outputs [13, 14, 22, 23, 44]. ...

Page 1 of 1