Getting the names of unicode pictograms
Question: I'm trying to analyse a text stream that includes unicode pictograms like
these:

    
    
     -> 128132 -> Lipstick
     -> 128133 -> Nail Polish
     -> 128139 -> Kiss Mark
    

I'd like to be able to look up the name of each of these characters, so for
example any time I encounter the glyph I'd like to replace it with an
alphanumeric symbol like "UNICODE_LIPSTICK".

Is there a data file somewhere that lists the numbers of all of the unicode
characters and their names? I'm after some kind of mapping (preferably in a
plain text format that's easily imported). Does such a data set exist?

I'm actually programming in Python 3, so if there's something built into the
language that would do this, even better!


Answer: You can use the [`unicodedata.name()`
function](https://docs.python.org/3/library/unicodedata.html#unicodedata.name)
to look up the official codepoint name:

    
    
    >>> import unicodedata
    >>> unicodedata.name(chr(128132))
    'LIPSTICK'
    >>> unicodedata.name(chr(128133))
    'NAIL POLISH'
    >>> unicodedata.name(chr(128139))
    'KISS MARK'
    

