ord python
what is ord in python
The
ord()
function returns the number representing the unicode code of a specified character.
- It is a built-in function in Python 3.
- For ASCII characters, the return value is the 7-bit ASCII code.
- For Unicode characters, the return value refers to the Unicode code point.
ord() Syntax
The syntax of ord() is:
ord(ch)
ord() python
ord() Parameters
The ord() function takes a single parameter:
- ch – a Unicode character
python ord function
ord('d') ord('1')
100 49
python ord()
ord() Return Value
The ord()
function returns an integer representing the Unicode character.
print(ord("😘")) print(ord("C")) print(ord("ß")) print(ord("J")) print(ord("卐"))
128536 67 223 74 21328