简体   繁体   English

TypeError:str对象不可调用

[英]TypeError: str object is not callable

This is my code: 这是我的代码:

fi=tarfile.open(os.path.join(pathin,file_in),'r')
list-fi.getmembers()
entries_list[]
for lis in list:
    name_list=lis.name()
    entries_list.append(name_list)
print entries_list.

At the line name_list=lis.name() , I'm getting the error str object is not callable . 在行name_list=lis.name() ,我得到错误str object is not callable Could you explain why? 你能解释为什么吗?

Thanks in advance. 提前致谢。

lis.name is a string, so lis.name() tries to call this string. lis.name是一个字符串,因此lis.name()尝试调用此字符串。 Because strings aren't callable, you get the error str object is not callable . 因为字符串不可调用,所以您会得到错误str object is not callable

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

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