Python ord() Function: Unicode Code Points

When the ord() function is called, it takes a string of length 1 as a parameter and returns the Unicode code point for that string. Unicode code point is an integer used to represent the position of a character in the Unicode encoding.

Here is an example demonstrating how to use the ord() function to get the Unicode code point of a character.

char = 'A'
unicode_code_point = ord(char)
print(f"The Unicode code point of '{char}' is {unicode_code_point}")

The output result will be:

The Unicode code point of 'A' is 65

The ord() function returns an integer representing the position of a character in Unicode. This integer can be used for comparing and sorting characters.

bannerAds