I have a line in python3 that has emojis in it, and I want to treat emojis as a unicode representation. I need to do some manipulation of emoji in this format.
s = '😬 😎 hello'
This applies to each emoji as his own character, so len(s) == 9&&s[0] == 😬
I want to change the format of the string so that it is at unicode points, so that
s = '😬 😎 hello'
u = to_unicode(s)
print(u)
u[0] == '\ud83d' and u[1] == '\ude2c'
len(u) == 11
Any thoughts on creating a function to_unicodethat will take s and change it to u? I could think about how / unicode lines work in python3, so any help / corrections would be appreciated.
source
share