Skip to content
Advertisement

how to fix TypeError: ‘str’ object is not callable in Python

Im gettng this error:

JavaScript

SyntaxWarning: ‘str’ object is not callable; perhaps you missed a comma?

For code:

JavaScript

Advertisement

Answer

The concatenation of strings works differently.

JavaScript

if you use Python 3.6+ or

JavaScript

for earlier versions.

You can also do as follows:

JavaScript

which makes your code more concise and pythonic.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement