ord() Builtin Function

Python – ord()

Python ord() builtin function returns the Unicode point of the given character.

Syntax

The syntax of ord() function is

ord(ch)

where

  • ch is a string with only one character.

Examples

Get Unicode point of character ‘m’

In the following program, we get the Unicode point for the character 'm'.

Python Program

unicode = ord('m')
print(unicode)
Run

Output

109

Summary

In this tutorial of Python Examples, we learned the syntax of ord() function, and how to use this function to get the Unicode point of the given character, with examples.