Emoji Data Python documentation¶
This is the documentation for the emoji_data_python module
Also available in Aphabetical order
Module documentation¶
-
emoji_data_python.
emoji_data
¶ List of all emoji as
emoji_data_python.EmojiChar
objects.>>> len(emoji_data_python.emoji_data) 489
-
emoji_data_python.
emoji_short_codes
¶ Dict of all emoji as
emoji_data_python.EmojiChar
objects indexed by short names.Note : All short names (even secondary) are indexed. If any conflicts are found, only the emoji who has the conflicitng shortname as primary name is indexed under that name ie. if an emoji has a secondary short name that is already taken as primary for an other emoji, this will not be referenced under that shortname
>>> emoji_data_python.emoji_short_names['hearts'].__dict__ { 'name': 'BLACK HEART SUIT', 'unified': '2665', 'variations': ['2665-FE0F'], 'docomo': 'E68D', 'au': 'EAA5', 'softbank': 'E20C', 'google': 'FEB1A', 'short_name': 'hearts', 'short_names': ['hearts'], 'text': None, 'texts': None, 'category': 'Symbols', 'sort_order': 245, 'added_in': '1.1', 'skin_variations': {}, 'obsoletes': None, 'obsoleted_by': None }
-
emoji_data_python.
all_doublebyte
()[source]¶ Returns all emoji coded on two or more bytes
- Return type
List
[EmojiChar
]
-
emoji_data_python.
char_to_unified
(chars)[source]¶ Returns a characters unified codepoint
- Parameters
chars (
str
) – Emoji character ex: ‘🇿🇦’
>>> emoji_data_python.char_to_unified('🇿🇦') '1F1FF-1F1E6'
- Return type
str
-
emoji_data_python.
find_by_name
(name)[source]¶ Finds emoji with name in their full name
- Parameters
name (
str
) – string to find in full names- Return type
List
[EmojiChar
]
-
emoji_data_python.
find_by_shortname
(name)[source]¶ Finds all emoji with name in their short_names
- Parameters
name (
str
) – string to find in short names
>>> emoji_data_python.find_by_shortname('moon') [ EmojiChar("NEW MOON SYMBOL"), EmojiChar("WAXING CRESCENT MOON SYMBOL"), EmojiChar("FIRST QUARTER MOON SYMBOL"), EmojiChar("WAXING GIBBOUS MOON SYMBOL"), EmojiChar("FULL MOON SYMBOL"), EmojiChar("WANING GIBBOUS MOON SYMBOL"), EmojiChar("LAST QUARTER MOON SYMBOL"), EmojiChar("WANING CRESCENT MOON SYMBOL"), EmojiChar("CRESCENT MOON"), EmojiChar("NEW MOON WITH FACE"), EmojiChar("FIRST QUARTER MOON WITH FACE"), EmojiChar("LAST QUARTER MOON WITH FACE"), EmojiChar("FULL MOON WITH FACE"), ]
- Return type
List
[EmojiChar
]
-
emoji_data_python.
get_emoji_regex
()[source]¶ Returns a regex to match any emoji
>>> emoji_data_python.get_emoji_regex().findall('Hello world ! 👋🏼 🌍 ❗') ['👋', '🏼', '🌍', '❗']
-
emoji_data_python.
replace_colons
(text, strip=False)[source]¶ Parses a string with colon encoded emoji and renders found emoji. Unknown emoji are left as is unless strip is set to True
- Parameters
text (
str
) – String of text to parse and replacestrip (
bool
) – Whether to strip unknown codes or to leave them as :unknown:
>>> emoji_data_python.replace_colons('Hello world ! :wave::skin-tone-3: :earth_africa: :exclamation:') 'Hello world ! 👋🏼 🌍 ❗'
- Return type
str
Classes¶
-
class
emoji_data_python.
EmojiChar
(data_blob)[source]¶ Represents an emoji character as parsed from the json data
Parse data into EmojiChar
- Parameters
data_blob (
dict
) – Dictionary of values loaded from the json format in emoji.json
>>> emoji.__dict__ { 'name': 'BLACK HEART SUIT', 'unified': '2665', 'variations': ['2665-FE0F'], 'docomo': 'E68D', 'au': 'EAA5', 'softbank': 'E20C', 'google': 'FEB1A', 'image': '2665.png', 'sheet_x': 1, 'sheet_y': 34, 'short_name': 'hearts', 'short_names': ['hearts'], 'text': None, 'texts': None, 'category': 'Symbols', 'sort_order': 245, 'added_in': '1.1', 'has_img_apple': True, 'has_img_google': True, 'has_img_twitter': True, 'has_img_emojione': True, 'has_img_facebook': True, 'has_img_messenger': True, 'skin_variations': {}, 'obsoletes': None, 'obsoleted_by': None }
-
property
all_variations
¶ Lists all possible codepoint variations for given emoji.
See
emoji_data_python.EmojiChar.chars
for a rendered version>>> emoji.all_variations ['261D', '261D-FE0F', '261D-1F3FB']
- Return type
List
[str
]
-
property
char
¶ Returns rendered char for emoji
>>> emoji.char '👋'
- Return type
str
-
property
chars
¶ Lists all possible rendered codepoint variations for given emoji. This is useful when trying to find this particular emoji in a string by looking for any variation.
>>> emoji.chars ['👋', '👋🏻', '👋🏼', '👋🏽', '👋🏾', '👋🏿']
- Return type
List
[str
]
-
property
is_doublebyte
¶ True if emoji is coded on two or more bytes
- Return type
bool