Article Directory
When you need a magic tool for filtering qualified elements, filter()
functions are your right-hand man. filter()
A function is a built-in function in Python, which is used to filter elements that meet certain conditions from an iterable object to form a new iterator.
Let's introduce filter()
the function in detail:
1. Definition
filter()
Functions are used to filter elements in an iterable object according to a specified function (filter condition). It returns an iterator containing elements that satisfy the filter condition.
Two, grammatical form
filter(function, iterable)
functi