ord() Builtin Function
Python - ord()
Python ord() builtin function returns the Unicode point of the given character.
In this tutorial, you will learn the syntax of ord() function, and then its usage with the help of example programs.
Syntax
The syntax of ord()
function is
ord(ch)
where
Parameter | Description |
---|---|
ch | A string value with only one character. |
The function returns an integer value.
Examples
1. 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)
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.