Questions tagged «python-3.2»


4
NameError:名称“ reduce”未在Python中定义
我正在使用Python 3.2。试过这个: xor = lambda x,y: (x+y)%2 l = reduce(xor, [1,2,3,4]) 并得到以下错误: l = reduce(xor, [1,2,3,4]) NameError: name 'reduce' is not defined 尝试打印reduce到交互式控制台中-出现此错误: NameError: name 'reduce' is not defined 是reduce在Python 3.2中真正删除的吗?如果是这样,还有什么选择?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.