Python chr() function
Learn how the chr() function in Python converts integers into characters and explore its range and usage - RRTutors. Check it out today!
Published February 15, 2022
"chr" stands for “characters” in most programming languages. Chr() is a Python built-in function that converts an integer into a character. This function accepts a number as an input, with a range of 0 to 1,1141,111 to output characters.
Syntax
Here is the syntax for implementing chr() function in python
| Chr(num) |
Where num is the value of the integer to be converted into characters
Example
In this example, we are going to convert integers to display the word "Python."
|
print( chr(112), chr(121), chr(116), chr(72), chr(111), chr(110) ) |
Output
| p y t H o n |