繁体   English   中英

列表 object 在 PYTHON 中不可调用

[英]List object is not callable IN PYTHON

def new(l):
    return l%2==0

list(filter(new,range(4,31)))

请有人解决这个问题。 我收到一个错误,列出 object is not callable

这个会起作用的。 它失败的唯一原因是因为您在代码中的某处将list声明为变量,例如list =.... ,因此内置类型被覆盖。 If you are doing from script change the variable name using Find and Replace in Text editor, or if you are in python shell then use del list , or restart the shell but you have to re-do things (but python history file will help you恢复)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM