Using the ord() function you can get Unicode code from a given character in Python. This function returns the number representing the Unicode code of a specified character.
ord() function in Python
A simple example code gets an integer representing the Unicode code point for the given Unicode character.
character = 'R' unicode_char = ord(character) print(unicode_char) print(ord('5')) print(ord('A')) print(ord('$'))
The chr() method returns a string representing a character whose Unicode code point is an integer.
value = ord("A") # prints the unicode value print (value) # print the character print(chr(value))
Do comment if you have any doubts or suggestions on this Python function.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.