In this tutorial, you will learn about the ord() function.ord() function returns the integer
representing Unicode character. In the previous tutorial, we have seen the open() function to open a file for reading and write.
Headings of Contents
Python ord() function
Python ord function is a built-in function that is used to returns the number representing the Unicode character of the specified character.
Syntax
The syntax of ord function in Python is:-
ord(ch)
Parameter
ord function in Python support one parameter:-
- ch:- a Unicode character
Return value
The ord() function returns an integer representing the Unicode character.
Example:
print(ord('a'))
print(ord('A'))
print(ord('#'))
Output
97
65
35
Conclusion
In this article, you have learned all about Python ord function along with examples.
ord function in Python returns the number that represents the Unicode character of the specified character.
If you like this guide, please comment and share it on your social media profile.
Python built-in functions
For more information:- Click Here