filter 与 map 与 reduce
''' filter :过滤掉一些东西 map :无特殊 reduce:一次性执行两个参数:让数组【1,2,3】变成123 ''' # print(list(filter(lambda x:True if x>3 else False,range(10)))) # print(list(map(lambda x:x**2 if x<5 else x,range(10)))) # import functools as fts # # 列表求和 # print(fts.reduce(lambda x,y:x+y,list(range(10)))) # #个十百千万这样搞 # print(fts.reduce(lambda x,y:10*x+y,range(1,10)))
-----------------------------------------------------------------------------------------------------------------------------------------