The chr()
function is one of Python's built-in functions used to convert an integer to its corresponding Unicode character.
Syntax:
chr(i)
Where i
is an integer representing a Unicode code point.
Here are some examples of using the chr()
function:
print(chr(97)) # Output: a
print(chr(8364)) # Output: €
print(chr(128149)) # Outputs a heart symbol
In Python 3, strings use Unicode encoding, so the chr()
function returns Unicode characters.
chr()
is the inverse function of ord()
.
See also: