The ord () function in Python
The built-in ord () function in Python returns an integer representing the Unicode code of the specified character.
Table of Contents
The built-in ord () function in Python returns an integer representing the Unicode code of the specified character.
Python's ord () function syntax
ord(c)
The ord () function is the reciprocal of the function chr ().
The parameter of ord () function
ord () has a unique parameter:
c: is any string, any character.
Value returned from ord ()
Ord () returns an integer representing the Unicode code of the specified character.
For example
# số nguyên print(ord('5')) # chữ cái print(ord('A')) # ký tự print(ord('$'))
Run the program, the result is:
53 65 36
See also: Built-in Python functions
4 ★ | 1 Vote
Read More
- Int () function in Python
- The function id () in Python
- The oct () function in Python
- The next () function in Python
- Hex () function in Python
- The map () function in Python
- The function dir () in Python
- The function set () in Python
- Help () function in Python
- Sum () function in Python
- The slice () function in Python
- The chr () function in Python
- The pow () function in Python
- The iter () function in Python