Easy Tutorial
❮ Python Os Closerange Ref Math Log2 ❯

Python3 ord() Function

Python3 Built-in Functions


Description

The ord() function is the counterpart of the chr() function (for 8-bit ASCII strings). It takes a string (Unicode character) as an argument and returns the corresponding ASCII value or Unicode code point.

Syntax

Here is the syntax for the ord() method:

ord(c)

Parameters

Return Value

The return value is the corresponding decimal integer.


Examples

The following examples demonstrate the use of the ord() method:

>>> ord('a')
97
>>> ord('€')
8364
>>>

Python3 Built-in Functions

❮ Python Os Closerange Ref Math Log2 ❯