-
-
map()
-
Prototype map (fn, lsd)
-
1 is a function of the parameter
-
2 is a list of parameters
-
-
Features
-
The functions passed successively to each element in the sequence, and to return the result as a new Iterator
-
-
-
reduce()
-
Need to import from functools import reduce
-
Prototype reduce (fn, lsd)
-
1 is a function of the parameter
-
2 is a list of parameters
-
-
Function: a function of acting on the sequence, this function must accept two parameters, and the reduce the result of the next element in the sequence continues to cumulative operation
-
-
-
filter()
-
Prototype filter (fn, lsd)
-
1 as a function parameter
-
2 is a sequence parameter
-
-
Function: the sequence for filtering (filter data)
-
Vernacular: The function passed successively to each element of the sequence, according to returns True or False decide whether to keep the element
-
-
sorted()
-
Sort: bubble, choose quick sort, insert, counter
-
sorted(lsd,key=)
-
A parameter sequence
-
Parameters 2key to accept function to implement custom sorting rules
-
-
sorted(lsd,reverse = True)
-
A parameter sequence
-
-
-
Three higher-order functions
Guess you like
Origin www.cnblogs.com/fengzi759/p/12001178.html
Recommended
Ranking