TypeError: can only concatenate str (not "float") to str

Error when executing the following

test.py


NUM=100.00
print("TEST:" + NUM)
$ python test.py
TypeError: can only concatenate str (not "float") to str

Solved by adding str

test.py


NUM=100.00
print("TEST:" + str(NUM))
$ python test.py
TEST:100.00

Recommended Posts

TypeError: can only concatenate str (not "float") to str
Convert exponential notation float to str in Python
[Error] TypeError: only integer arrays with one element can be converted to an index
Only size-1 arrays can be converted to Python scalars