执行下行出现如下错误
reduce(lambda x
, y
: x
+ y
, range(101))
Traceback
(most recent call last
):
File
"C:/Users/HuiSenNA/Desktop/My_code/MySelf_play/day04.py", line
3, in <module
>
reduce(lambda x
, y
: x
+ y
, range(101))
NameError
: name
'reduce' is not defined
解决方案
python3 中的 reduce 函数和 python2.7 不在同一个库里了
from functools
import reduce
转载请注明原文地址: https://lol.8miu.com/read-20895.html