使用降低功能时出乎意料的typeError
这是代码行:
product = list(reduce(lambda a, b: a*b, [2,2,2,2,2]))
错误:
typeError:'int'对象不是Itable
Here is the line of code:
product = list(reduce(lambda a, b: a*b, [2,2,2,2,2]))
Error:
TypeError: 'int' object is not iterable
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果要将结果放入列表中,则可以使用此代码:
无法使用列表函数,因为它与类型转换相对应,因为结果是整数。
if you want to put your result in a list, you can use this code:
The list function cannot be used because it corresponds to a type conversion which is not possible as your result is an integer.
因此,您无法制作
列表
。So you can't make a
list
of it.