Python Function Reference

chr

Get the character with the given Unicode code point.

Python 3.13
chr(i)

Parameters

iint
A code point from 0 to 1114111.

Return value

A string of one character; raises ValueError for a code point out of range.

Examples

Character by code

Python 3.13
print(chr(65))
A

Next letter of the alphabet

Python 3.13
print(chr(ord('a') + 1))
b

Details

The inverse function is ord: chr(ord(c)) returns the same character. Codes below 32 are control characters that do not print as letters: chr(10) is a newline, chr(9) is a tab.

See also