user1240863
user1240863

Reputation: 41

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. Could you explain why?

Thanks in advance.

Upvotes: 1

Views: 11143

Answers (1)

Sven Marnach
Sven Marnach

Reputation: 601401

lis.name is a string, so lis.name() tries to call this string. Because strings aren't callable, you get the error str object is not callable.

Upvotes: 6

Related Questions