Python reduce未定义

问题:

 name 'reduce' is not defined

解决:

from functools import reduce

原因:

在python 3.0.0.0以后, reduce已经不在built-in function里了

你可能感兴趣的:(Python)