Convert integer to string in Python

We can convert an integer data type using the python built-in str() function. This function takes any data type as an argument and converts it into a string. But we can also do it using the “%s” literal and using the .format() function.

How to convert an integer to a string in Python

Below is the list of possible ways to convert an integer to string in python:

1. Using str() function :

Syntax: str(integer_value)

Convert Integer to String in Python Using str() function
Output:
Convert Integer to String in Python Using str() function Output

2. Using “%s” keyword:

Syntax: “%s” % integer

Convert Integer to String in Python Using s keyword

Output:

Convert Integer to String in Python Using str() function Output
3. Using .format() function:

Syntax: ‘{}’.format(integer)

Convert Integer to String in Python Using format function
Output:

Using .format() function op

4. Using f-string:

Syntax: f'{integer}’

Convert-Integer-to-String-in-Python-Using-f-string
Output:

Convert Integer to String in Python Using f string output

Conclusion:

We have defined all methods of converting the integer data type to the string type. You can use one of them according to your requirement.