Print Emoji's using python.

Shashank Shanu

9 months ago

Emoji's
Emoji's
Today we try to see how we can print different emoji in python. 
Python provides emoji function which can create some fun in our coding language.
Let's begin

Using emoji module:

Emojis can also be implemented by using the emoji module provided in Python.  To install it run the following in the terminal.
pip install emoji
Let's see some example's
Example 1:
emojize() function requires the CLDR short name to be passed in it as the parameter. It then returns the corresponding emoji. Replace the spaces with an underscore in the CLDR short name.
# import emoji module  

import emoji 
print(emoji.emojize(":grinning_face_with_big_eyes:")) 
print(emoji.emojize(":winking_face_with_tongue:")) 
print(emoji.emojize(":zipper-mouth_face:")) 
Output: The above code gives as the result-
code gives as the result
code gives as the result
Check this cheat sheet for an entire list of the emoji module names.
An alternative of the above two methods is using the emoji modules in order to print emojis. This requires the installation of emoji pip package:
Example 2:
print(“\U0001F603”);    #grinning face with big eyes
print(“\U0001F600”);    #grinning face
print("\U0001F916");    #robot
output: The code will give the below results
code will give the below results
code will give the below results
The emojize() function requires the CLDR short name to be passed in it as the parameter. It then returns the corresponding emoji.
One of the important things to keep in mind is to replace every space with an underscore in the CLDR name string.
I hope you enjoyed reading this article and finally, you came to know about Print Emoji's using python.
For more such blogs/courses on data science, machine learning, artificial intelligence and emerging new technologies do visit us at InsideAIML.
Thanks for reading…
Happy Learning…

Submit Review