Sometimes, we want to convert an integer to string in Python.
In this article, we’ll look at how to convert an integer to string in Python.
How to convert an integer to string in Python?
To convert an integer to string in Python, we can use the str
function.
For instance, we write:
num = str(10)
print(num)
We call str
with the number we want to convert to a string.
And the string version of the number is returned.
Then num
is '10'
.
Conclusion
To convert an integer to string in Python, we can use the str
function.