In [1]:
# http://www.unicode.org
# http://www.unicode.org/charts/
# https://docs.python.jp/3/howto/unicode.html

In [2]:
import unicodedata

In [3]:
s = 'あ'
print(unicodedata.name(s))


HIRAGANA LETTER A

In [4]:
name = 'grinning face'
value = unicodedata.lookup(name)
print(value)
print(type(value))


😀
<class 'str'>

In [5]:
print('\N{grinning face}')


😀

In [6]:
u8 = value.encode('utf-8')
print(u8)
print(type(u8))


b'\xf0\x9f\x98\x80'
<class 'bytes'>

In [7]:
ue = value.encode('unicode-escape')
print(ue)
print(type(ue))


b'\\U0001f600'
<class 'bytes'>

In [8]:
emoji = '\U0001f600'
print(emoji)


😀

In [9]:
emoji_2 = '\U0001f601'
print(emoji_2)


😁

In [10]:
print(unicodedata.name(emoji_2))


GRINNING FACE WITH SMILING EYES

In [11]:
u8_2 = emoji_2.encode('utf-8')
print(u8_2)
print(type(u8_2))


b'\xf0\x9f\x98\x81'
<class 'bytes'>