Skip to content Skip to sidebar Skip to footer

'str' Object Is Not Callable - Caution: Do No Use Special Functions As Variables

EDIT: If you define a predefined type such as: str = 5 then the original functionality of that predefined will change to a new one. Lesson Learnt: Do not give variables name

Solution 1:

The problem is str function must have been overloaded.

Input:

X=5print("X value is:"+str(X))

Output: X value is:5

Input:

X=5str = "98897"print("X value is:"+str(X))

Output: TypeError Traceback (most recent call last) in () ----> 1 print("X value is:"+str(X))

TypeError: 'str' object is not callable

Post a Comment for "'str' Object Is Not Callable - Caution: Do No Use Special Functions As Variables"