reduce 和 map 函数

import functools as ft

s=ft.reduce(lambda x,y:x+y,[3,1,2,3]) # 据说 黑豆看不上reduce函数,给扔到functools里边了

print(s) # 9

ss=map(lambda x,y:x+y,[3,1,4],[2,8,9])

print(list(ss)) # [5, 9, 13]
原文地址:https://www.cnblogs.com/david-python/p/13859465.html