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(ch)
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('$'))
Output:

chr() functions
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))
Output:
65
A
Do comment if you have any doubts or suggestions on this Python function.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
Windows 10
Python 3.10.1
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.