name 'reduce' is not defined

原因:
在Python 3里,reduce()函数已经被从全局名字空间里移除了,现被放置在fucntools模块里

修正:先引入后使用

from functools import reduce

猜你喜欢

转载自blog.csdn.net/weixin_39777626/article/details/80075367