TypeError: 'xxx' is not callable
occurs when a non-function is written like a function call (i.e., ()
immediately after it).
Let me show you an example.
>>> a = 1
>>> a()
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
a()
TypeError: 'int' object is not callable
>>> b = "abc"
>>> b(3, 4)
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
b(3, 4)
TypeError: 'str' object is not callable
>>> c = range(32)
>>> c(33, "a")
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
c(33, "a")
TypeError: 'range' object is not callable
© 2024 OneMinuteCode. All rights reserved.