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 namesNote : 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.
unified_to_char
(code_point)[source]¶ Renders a character from its hexadecimal codepoint
Parameters: code_point ( str
) – Character code point ex: ‘261D’>>> emoji_data_python.unified_to_char('1F603') '😃'
Return type: str
-
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 replace - strip (
bool
) – Whether to strip unknown codes or to leave them as :unkown:
>>> emoji_data_python.replace_colons('Hello world ! :wave::skin-tone-3: :earth_africa: :exclamation:') 'Hello world ! 👋🏼 🌍 ❗'
Return type: str
- text (
-
emoji_data_python.
all_doublebyte
()[source]¶ Returns all emoji coded on two or more bytes
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
]
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', '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 }
-
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
]
-
char
¶ Returns rendered char for emoji
>>> emoji.char '👋'
Return type: str
-
chars
¶ Lists all possible rendered codepoint variations for given emoji. This is useful when tying to find this particular emoji in a string by looking for any variation.
>>> emoji.chars ['👋', '👋🏻', '👋🏼', '👋🏽', '👋🏾', '👋🏿']
Return type: List
[str
]
-
is_doublebyte
¶ True if emoji is coded on two or more bytes
Return type: bool
-