Describing itertools.filterfalse(condition, itr)
- The
filterfalsefunction is used to: - Cycle through each element of an iterable - Includes elements that fail the condition - This condition is based on the
conditionparameter - This iterable is based on the
itrparameter filterfalsereturns an iterator that filtersitrelements that fail thecondition
Illustrating the filterfalse Function
>>> from itertools import filterfalse
>>> cond = lambda x: x>5
>>> nums = [7,6,5,8,4]
>>> itr = filterfalse(cond, nums)
>>> for i in itr: print(i)
5
4References
Previous
Next