reduce, map, filter usage

# Filter usage (for each data filter, to meet the conditions of reservations) 
#. 1, filter (performance function, container type data)
# 2, filtered off is an address, for packaging List, or tuple
#. 3, filtered off the container is a subset of the original data type

# use the reduce (a result of processing all data)
#. 1, the reduce (performance function, container type data) Note: typically two parameters performance function
# 2, all the data are combined one consequence

# map usage (for each data processing, post-processing data length and the original length of the vessel as)
#. 1, Map (performance function, container type data)
# 2, the data length of the original length of the data obtained the same

# using reduce calculation 1-100 and
# filtered using filter 20 is older than the data
# my_list = [{ 'name' : ' John Doe', 'age': 24} , { 'name': ' Wang Wu', 'age' : 12}, { 'name' : ' Zhao six', 'Age': 32}]
#
# Print (the reduce (the lambda X, Y: X + Y, [I for I in Range (. 1, 101)]))
# print (list (filter (lambda x: x [ 'age']> 20, my_list)))

Guess you like

Origin www.cnblogs.com/wjun0/p/11515364.html