반응형
Calling a Non-Callable Object
Problematic Code:
number = 10
result = number()
Error Message:
TypeError: 'int' object is not callable
Solution: Here, number is an integer (int), so it cannot be called like a function. If you intended to use the variable, remove the parentheses.
result = number
Alternatively, if you intended to call a function, ensure you are using the correct function.
def number():
return 10
result = number()
반응형
'Python > error debug' 카테고리의 다른 글
TypeError: can't multiply sequence by non-int of type 'list' (0) | 2024.08.17 |
---|---|
TypeError: can only concatenate str (not "int") to str (0) | 2024.08.17 |
NameError: name 'greet' is not defined (0) | 2024.08.10 |
NameError: name 'nam' is not defined (0) | 2024.08.10 |
NameError: name 'name' is not defined (0) | 2024.08.10 |