>>> list=zip('1234','abc')
>>> list(list)
Traceback (most recent call last):
File "<pyshell#42>", line 1, in <module>
list(list)
TypeError: 'zip' object is not callable
>>> l=zip('ab','123')
>>> l
<zip object at 0x03562238>
>>> list(l)
Traceback (most recent call last):
File "<pyshell#45>", line 1, in <module>
list(l)
TypeError: 'zip' object is not callable
这是因为自定义了list,所以出错,del(list)后,就可以了。
>>> del(list)
>>> list(l)
[('a', '1'), ('b', '2')]
本文介绍了在Python中使用zip函数时遇到的一个常见错误——尝试将zip对象作为函数调用。文章详细解释了这一错误的原因,并提供了如何正确地将zip对象转换为列表的方法。

2万+

被折叠的 条评论
为什么被折叠?



