Python ord() function
Return the Unicode code number of a character.
Syntax
ord(c)
The opposite of chr.
Parameters
| c | a single character |
Return value
int
Example
Code
print(ord("A"), ord("a"), ord("€")) print(ord("b") - ord("a"))
Output
65 97 8364 1
Related
Learn it step by step in the free lesson Strings, with exercises that check your answers.