Printing Emojis In Python

  • Home
  • Printing Emojis In Python
Printing Emojis In Python

Emojis are ideograms and smileys used in electronic messages and web pages. They exist in various forms, this includes facial expressions, common objects, places, types of weather, and animals. Emojis are pictures that can be represented as encoded characters. They are applied to messaging stickers by extension. Emojis are used to express feelings. On social media, they are created several times a day.

There is a number of ways in which Emojis can be printed in python. This includes using Unicode, CLDR names, and emoji module.

 Using Unicodes

From the list of Unicode replace “+” with “000”.For example” U+1F971” will change to “U0001F971”.You should prefix the Unicode with”\” and print it. For example for an angry face  Print( “\U0001F620”). Every emoji has a unique code.

Using Emoji Module

You need to install the emoji module provided by python. Run the pip install emoji in your notebook.

pip install emoji

Emojize () function requires the CDRL short name to be passed into its parameter. It then returns the corresponding emoji.

# import emoji module 

import emoji

print(emoji.emojize(“:angry_face_with_big:”))

print(emoji.emojize(“:Smiling_face_with_horns:”))

print(emoji.emojize(“:Pouting_face:”))

Using CLDR Short Name

On running, this method returns the corresponding emoji. For example, for yawning face

Print (“\N {yawning face}”).

You can try this with other CLRD names. You can also convert an emoji to its corresponding CLDR short name using demojize () function.

2 Comments

  1. Its good but how do you cater for emojis that express two or more thoughts?? What about emojis that do not necessarily express feeling? Like for example 🌊

Leave a Reply

Your email address will not be published. Required fields are marked *