Converting integer to string in Python
There is not typecast and no type coercion in Python. You have to convert your variable in an explicit way.
To convert an object in string you use the str()
function. It works with any object that has a method called __str__()
defined. In fact
str(a)
is equivalent to
a.__str__()
The same if you want to convert something to int, float, etc.