December 2018
Beginner to intermediate
796 pages
19h 54m
English
According to the Python documentation:
Let's see a very quick example:
# filter.py>>> test = [2, 5, 8, 0, 0, 1, 0]>>> _(filter(None, test))[2, 5, 8, 1]>>> _(filter(lambda x: x, test)) # equivalent to previous one[2, 5, 8, 1]>>> _(filter(lambda x: x > 4, test)) # keep only items > 4[5, 8]
In the preceding code, notice how the second call to filter is equivalent to the first one. If we pass a function that takes one argument ...
Read now
Unlock full access