English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Python basic tutorial

Python flow control

Fonctions en Python

Types de données en Python

Python file operations

Python objects and classes

Python date and time

Advanced Python knowledge

Python reference manual

Python ord() usage and examples

Python built-in functions

The ord() function returns an integer representing a Unicode character.

The syntax of ord() is:

ord(ch)

ord() parameter

The ord() function takes a single parameter:

  • ch -Unicode character

ord() return value

The ord() function returns an integer representing a Unicode character.

Example: How does ord() work in Python?

print(ord('5))  # 53
print(ord('A'))  # 65
print(ord('$'))  # 36

Output result

53
65
36

By the way, the ord() function is withPython chr() functionThe opposite function

Python built-in functions