Python ord() Method

The ord() method returns an integer representing the Unicode character.

Syntax:

ord(char)

Parameters:

char: A unicode character.

Return Value:

Returns an integer value.

The following example returns the integer representation of various unicode characters.

Example: ord()
print("A = ", ord('A'))
print("Z = ", ord('Z'))
print("a = ", ord('a'))
print("z = ", ord('z'))
print("$ = ", ord('$'))
print("ä = ", ord('ä'))
Output
A = 65
Z = 90
a = 97
z = 122
$ = 36
ä = 228
Want to check how much you know Python?