How to convert an integer to a character in Python?



Python's built-in function chr() returns a sunicode character equivalent of an integer between 0 to 0x10ffff.

>>> chr(a)
'd'
>>> chr(300)
'Ĭ'
>>> chr(65)
'A'

Advertisements