I have a Python program that uses a dictionary with Unicode number strings in it, then prints out the actual character. My code looks like this:
unicodeChars = {'bullet': 'u 2022'}
print(chr(unicodeChars['bullet']))
But I am receiving the following error:
TypeError: 'str' object cannot be interpreted as an integer
Can I solve this somehow?
CodePudding user response:
Take a look at the Unicode HOWTO. You will see that you really are looking for this instead:
unicodeChars = {'bullet': '\u2022'}
print(unicodeChars['bullet'])