Python ord() Function

❮ Built-in Functions


Example

Return the integer that represents the character "h":

x = ord("h")
Try it Yourself »

Definition and Usage

The ord() function returns the number representing the unicode code of a specified character.


Syntax

ord(character)

Parameter Values

Parameter Description
character String, any character

Related Pages

Convert back to character with the chr() function.


❮ Built-in Functions

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.