The Python function ord provides an integer that signifies the Unicode code point for a specified Unicode character.
Python ord Function Syntax
It has the following syntax:
ord(character)
Parameters
- character: A string consisting of a single character.
Return
It yields an integer that signifies the Unicode code point corresponding to the specified Unicode character.
Python ord Function Example
The following example demonstrates how the ord function operates in Python.
# Code point of an integer
print(ord('8'))
# Code point of an alphabet
print(ord('R'))
# Code point of a character
print(ord('&'))
Output:
56
82
38
Explanation:
In the preceding illustration, it produces an integer that signifies the Unicode code point for the specified Unicode character.