How to Convert the integer to character in Python
In this tutorial, we are going to learn about how to convert the integer to an character (char) in Python with the help of examples.
Consider, we have a following integer (80) in our code:
integer = 80
Now, we need to convert the above integer
80 to the string representation of a character ‘P’.
Using the chr() function
To convert an integer to a character, we can use the built-in
chr() function in Python.
chr() function takes the integer as an argument and converts it’s to the string representation of a unicode character.
Here is an example, that converts character
80 to a character:
integer = 80 a = chr(integer) print(a)