icon

Convert Character to Unicode in Python

Last modified: 2023-08-29

We can easily convert a character to Unicode using the ord method in Python.

Conversion

We can use ord method in Python to convert a character to Unicode.

ord('a')
# 97

By the way, use chr method to convert Unicode to a character.

chr(97)
# a