Python ord() function

Published February 16, 2022

Python's ord() method outputs the Unicode code of a specified character. This function takes a unit-length text as an input and outputs the Unicode equivalent of the passed parameter.

Syntax
The following is the syntax of the ord() function.

ord(the Unicode character)

 

The Python ord() Example

In this example, we are going to  find the unicode code of characters "C" and "F".

a = ord("C")
b = ord('F')
print (a, b)

 

Output

67 70

 

 

Download Source code

 

Article Contributed By :
https://www.rrtutors.com/site_assets/profile/assets/img/avataaars.svg

228 Views