filter函数
1 people = ['tanglaoer_sb', 'chenlaosan_sb', 'linlaosi', 'wanglaowu_sb'] 2 res = filter(lambda n:not n.endswith('sb'),people) 3 print(list(res))
map函数
1 msg = 'tanglaoer' 2 print(list(map(lambda x:x.upper(),msg))) #['T', 'A', 'N', 'G', 'L', 'A', 'O', 'E', 'R']
reduce函数
1 from functools import reduce 2 num_list = [1,2,3,100] 3 print(reduce(lambda x,y:x+y,num_list)) #106