English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The chr() method returns a character (string) from an integer (representing the Unicode encoding point).
The syntax of chr() is:
chr(i)
The chr() method takes one parameter, that is, an integeri.
The valid range of integers is from 0 to1,114,111.
chr() returns:
is the Unicode code point as an integeriof the character (string)
If the integeriIf out of range, an error ValueError will be raised.
print(chr(97)) print(chr(65)) print(chr(1200))
When running the program, the output is:
a A Ұ
print(chr(-1))
When you run the program, a ValueError will be raised.
This is because the parameter passed to the chr() method is out of range.