标签:class ber items lis put square word 输入 span
Map
会将一个函数映射到一个输入列表的所有元素上
map(function_to_apply, list_of_inputs)
items = [1, 2, 3, 4, 5]
squared = list (map(lambda x: x**2, items))
number_list = range(-5, 5)
less_than_zero = filter(lambda x: x < 0, number_list)
from functools import reduce
product = reduce( (lambda x, y: x * y), [1, 2, 3, 4] )
标签:class ber items lis put square word 输入 span
原文地址:http://www.cnblogs.com/yingchen/p/7325175.html