Input Unicode character string and output the corresponding character

Question:

Have a Python program that stores a dictionary with Unicode number strings in it, then gets the string and prints out the actual character.
My code looks like this:

unicodeChars = {'bullet': 'u+2022'}
print(chr(unicodeChars['bullet']))

But when I run the program, it prints out the Unicode character string, (u+2202), not the actual character.
I’m using Python 3 in a Windows 11 64-bit laptop.

Asked By: Ben the Coder

||

Answers:

Take a look at the Unicode HOWTO. You will see that you really are looking for this instead:

unicodeChars = {'bullet': 'u2022'}
print(unicodeChars['bullet'])
Answered By: accdias