How to Convert ASCII value to a Character in Python
In this tutorial, we are going to learn about how to convert the ASCII value to a character in Python with the help of examples.
Consider, we are having the following ASCII value in our code:
a = 45
Using the chr() function
To convert the ASCII value to a character, we can use the built-in method chr()
in Python.
The chr() function takes the ASCII code as an argument and returns it’s character representation.
Here is an example:
a = 89
c = chr(a)
print(c)
Output:
Y
The above code prints the character Y
for the ASCII value 89.
Additional Resources
You can also checkout the related tutorials :