Python filter() function

The filter() method facilitates a functional approach to Python programming . It allows the developer to write simpler, shorter code , without necessarily needing to bother about intricacies like loops and branching.

How to filter a list in Python

The filter() method returns an iterator were the items are filtered through a function to test if the item is accepted or not. The returned iterable may be either a sequence, a container which supports iteration, or an iterator. If function is None , the identity function is assumed, that is, all elements of iterable that are false are removed.


  1. function : The function that tests if elements of an iterable returns true or false.
  2. iterable : The iterable to be filtered.

How to filter a list in Python


How to use the filter() method in Python

Python filter using lambda expression

 (C) 2022    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About