>>> def f(x,y): return x+y >>> reduce(f,[1,3,5,7,9],100) Traceback (most recent call last): File "
", line 1, inreduce(f,[1,3,5,7,9],100) NameError: name 'reduce' is not defined 为什么在python里面找不到函数#3>同学你使用的是Python3吧!在Python 3里,reduce()函数已经被从全局名字空间里移除了,它现在被放置在fucntools模块里。用的话要 先引入from functools import reduce