Python Ord


Ord function

The ord() function return an integer representing the ASCII code for a given string(the string is an ASCII character). The ord() function is the opposite of chr().

Examples

Example 1

>>> ord('A')
65
>>> ord('B')
66
>>> ord('a')
97
>>> ord('b')
98
>>> ord('c')
99
>>> ord('d')
100
>>>

Example 2

>>> ord('0')
48
>>> ord('1')
49
>>> ord('2')
50
>>>