Startec Startec - 9 months ago 51
Python Question

How to get the Unicode Code Point (as in from the database) in Python 3

For the copyright sign,
the unicode website lists "U+00A9"

Is there a way for me to get that exact number, or string, from Python 3 of any Unicode point?

I have tried all of the following:

ord('©') = 169
'©'.encode('unicode_escape') = b'\\xa9'
'\N{COPYRIGHT SIGN}'.encode('utf-8') = b'\xc2\xa9'

and I do not know what else to try. I'm looking for a solution that would work for all Unicode Code Points (including, for instance the

Answer Source
>>> 'U+{:04X}'.format(ord('©'))