I have a database of Unicode strings for emoji such as U0001F60A
. I want to pull them from the database and convert them into actual usable unicode strings. (So they appear as emoji and not a bunch of characters.) The standard form seems to be u'\U0001F60A'
, however, I cannot get this form.
if sentiment < 0:
emoji = cursor.execute("SELECT emojiuni FROM emojineg WHERE id='{}';".format(num)) # Get negative emoji from DB.
emoji = cursor.fetchone()
emoji = emoji[0]
This makes emoji = U0001F60A
but I can't append it to u'\
trying variations like
`"u'\" + emoji + "'"`
u' + "\" + emoji + "'"
u'\emoji
Don't work, because u'
seems to be a protected command. Is there a way to make the strings into unicode characters, along the lines of the encode()
command? (I've tried that also, but that doesn't seem to work, but maybe I'm not doing it right.) Any help is greatly appreciated.