Movatterモバイル変換


[0]ホーム

URL:


Python's filter(): Extract Values From Iterables

Filtering Iterables With Python

Python’sfilter() is a built-in function that allows you to process an iterable and extract those items that satisfy a given condition. This process is commonly known as afiltering operation. Withfilter(), you can apply afiltering function to an iterable and produce a new iterable with the items that satisfy the condition at hand. In Python,filter() is one of the tools that you can use forfunctional programming.

In this video course, you’ll learn how to:

  • Use Python’sfilter() in your code
  • Extractneeded values from your iterables
  • Combinefilter() with otherfunctional tools
  • Replacefilter() with morePythonic tools

With this knowledge, you’ll be able to usefilter() effectively in your code. Alternatively, you have the choice of usinglist comprehensions orgenerator expressions to write morePythonic and readable code.

To better understandfilter(), it would be helpful for you to have some previous knowledge oniterables,for loops,functions, andlambda functions. You can also refresh your memory of lambda functions through avideo course.

What’s Included:

Downloadable Resources:

Related Learning Paths:

Start Now

Get Started With filter()

5 Lessons 19m

  1. 1. Filter Iterables With Python (Overview)02:27
  2. 2. Understand the Concept of Filtering02:35
  3. 3. Filter Iterables With filter()05:39
  4. 4. Extract Even Numbers04:13
  5. 5. Find Palindrome Strings04:21

Use filter() for Functional Programming

5 Lessons 26m

  1. 1. Code With Functional Programming03:52
  2. 2. Explore Lambda Functions03:14
  3. 3. Combine filter() and map()08:00
  4. 4. Combine filter() and reduce()06:45
  5. 5. Filter Iterables With filterfalse()04:14

Code With Pythonic Style

3 Lessons 9m

  1. 1. Replace filter() With a List Comprehension02:57
  2. 2. Extract Even Numbers With a Generator04:58
  3. 3. Filter Iterables With Python (Summary)01:34
Start Now

AboutNegar Vahid

Negar is a researcher in quantum computing and explainable AI, and a content creator at Real Python.

» More about Negar

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Related Courses:

← Browse All Courses


[8]ページ先頭

©2009-2026 Movatter.jp