Emogi is a small digital image or icon used to express an idea or emotion.
Emojis are the βheartβ of any text conversation. They are the most interactive elements of any conversation. Over the internet, it may be difficult to express your feelings, emojis can help you to do the same. You and your friends may probably be using different emojis in your chats. Those cute little faces to broken heart emoji, it is very interesting and easy to use them in your day to day conversation.
Being a python programmer have you ever thought of using emojis in your programs?
You might be thinking for doing the same you will have to write big algorithm to print emojis. But its not as complex as you are thinking.
Python has multiple ways of using emoji in your python program which you can print in very simplified manner. These 3 ways are as follows.
- Unicodes
- CLDR names
- Emoji Module
Before we explore the ways to use this in code lets explore list of emojis available for us to use
- For Full Emoji List click here :- This chart provides a list of the Unicode emoji characters and sequences, with images from different vendors, CLDR name, date, source, and keywords.
- For Full Emoji Modifier Sequences click here :- Emoji with skin-tones are listed here.
- For counts of emoji, see
Now lets try to utilize these emojis in our python code.
πEmojisπ In Python Using Unicode's:
To use Unicode's in python , we need to replace β+β with β000β from the list of Unicode's.
For example : βU+1F600β will become βU0001F600β and prefix the Unicode with β\β escape character and print it.
Few working examples for your reference is as follows
print("\U0001F600") #This is smiley for grinning face π
print("\U0001F603") #This is smiley for grinning face with big eyes π
print("\U0001F604") #This is smiley for grinning face with smiling eyes π
print("\U0001F601") #This is smiley for beaming face with smiling eyes π
print("\U0001F606") #This is smiley for grinning squinting face π
print("\U0001F605") #This is smiley for grinning face with sweat π
print("\U0001F923") #This is smiley for rolling on the floor laughing π€£
print("\U0001F602") #This is smiley for face with tears of joy π
print("\U0001F642") #This is smiley for slightly smiling face π
print("\U0001F643") #This is smiley for upside-down face π
print("\U0001FAE0") #This is smiley for melting face π«
print("\U0001F609") #This is smiley for winking face π
print("\U0001F60A") #This is smiley for smiling face with smiling eyes π
print("\U0001F607") #This is smiley for smiling face with halo π
πEmojis π In Python Using CLDR Names
Emojis have CLDR short names which can also be used. While implementing it in python code put \N at start and the CLDR Names in "{}" braces to use it.
Few working examples for your reference is as follows
print("This is grinning face Smiley: ""\N{grinning face}") π
print("This is grinning face with smiling eyes Smiley: ""\N{grinning face with smiling eyes}") π
print("This is rolling on the floor laughing Smiley: ""\N{rolling on the floor laughing}") π€£
print("This is face with tears of joy Smiley: ""\N{face with tears of joy}") π
print("This is slightly smiling face Smiley: ""\N{slightly smiling face}") π
print("This is upside-down face Smiley: ""\N{upside-down face}") π
print("This is winking face Smiley: ""\N{winking face}") π
print("This is smiling face with smiling eyes Smiley: ""\N{smiling face with smiling eyes}") π
print("This is smiling face with halo Smiley: ""\N{smiling face with halo}") π
πEmojisπ In Python Using Emoji Module:
To use this module first install emoji module on your machine by using below command
pip install emoji --upgrade
There are other ways too for installing this module checkout the official documentation here
After you install this module you just have to use it in your print statement for example
import emoji
print(emoji.emojize('Python is :thumbs_up:'))
print(emoji.emojize('Python is :bowtie:'))
print(emoji.emojize('Python is :laughing:'))
print(emoji.emojize('Python is :kissing_heart:'))
print(emoji.emojize('Python is :grinning:'))
You can choose your required emojis from this link
Checkout the git hub repo for full code here