Reputation: 112
I've looked through several questions and I can't seem to find the exact answer to what I need.
I am trying to figure out how to take an emoji and use unicodedata.name() to return it's name.
So for example, I have this emoji: 💩. I want to be able to get it's identifier and get the value of it's name (PILE OF POO). I want to know how to construct the string to pass in to the name function:
unicodedata.name(u'\U0001f4a9')
The above code works. However passing as such:
unicodedata.name(💩)
returns the following:
mojidict['hi'] = unicodedata.name(\U0001f4a9) ^ ^
SyntaxError: invalid character in identifier
Upvotes: 0
Views: 418
Reputation: 9998
The solution is very simple:
import unicodedata
unicodedata.name('💩')
which returns:
'PILE OF POO'
Upvotes: 2