Home » Display emojis using the Python Emoji Module

Display emojis using the Python Emoji Module

Java SE 11 Developer (Upgrade) [1Z0-817]
Java SE 11 Programmer I [1Z0-815] Practice Tests
Spring Framework Basics Video Course
Java SE 11 Programmer II [1Z0-816] Practice Tests
Oracle Java Certification
1 Year Subscription

In this example we use a package to display emojis

The entire set of Emoji codes as defined by the Unicode consortium is supported in addition to a bunch of aliases.

By default, only the official list is enabled but doing emoji.emojize(language='alias') enables both the full list and aliases.

Installation

$ pip install emoji

Code

I used thonny for development

We use the emojize() function with the short CLDR names of Emojis in the following example program to print emojis:

import emoji  

# Print different type of Emojis   
print("Emoji with grinning faces: ", emoji.emojize(":grinning_face_with_big_eyes:"))  
print(emoji.emojize(":grinning_squinting_face:"))  
print(emoji.emojize(":grinning_face_with_smiling_eyes:"))  
print("Emoji with beaming face: ", emoji.emojize(":beaming_face_with_smiling_eyes:"))

# More popular Emojis  
print("More Emojis: ")  
print(emoji.emojize(":grinning_face:"))  
print(emoji.emojize(":upside-down_face:"))  
print(emoji.emojize(":zany_face:"))  
print(emoji.emojize(":shushing_face:"))

In the REPL window you will see the emojis

List of emojis

CLDR short name for Emoji
beaming face with smiling eyes
grinning face
face with tears of joy
smiling face with halo
face blowing a kiss
kissing face with smiling eyes
zany face
face with hand over mouth
face with raised eyebrow
smirking face
lying face
drooling face
nauseated face
grinning face with big eyes
grinning face with sweat
upside-down face
smiling face with 3 hearts
kissing face
face savouring food
squinting face with tongue

You may also like

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More