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 = 21Now, we need to convert the above integer 21 to a string "21".
Using str() function
To convert an integer to a string, we can use the built-in str() function in Python.
The 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))Output:
'21'

