Convert integer to a string in Python
In this tutorial, we are going to learn about how to convert the integer to an string in Python with the help of examples.
Consider, we have a following integer in our code:
num = 21
Now, we need to convert the above integer
21 to a string
Using str() function
To convert an integer to a string, we can use the built-in
str() function in Python.
str() function takes the integer as an argument and converts it to the string.
Here is an example that converts integer
21 to a string.
num = 21 print(str(num))