How to print emojis using Unicodes in python

Overview

An emoji is a pictogram, logogram, ideogram, or smiley embedded in the text and used in electronic messages and web pages. They can represent emotion, weather conditions, hand gestures, people, animals, objects, etc. They replace the conventional typographical style.

In python, emojis can be printed using their respective Unicodes. For example, the grinning face with big eyes emoji has a Unicode of U+1F603. When using such a Unicode in our code, we replace the “+” with “000” so that U+1F603 becomes U0001F603.

Printing emojis using Unicode

  • Step 1: Replace the "+" with "000" in any of the Unicode.

  • Step 2: Prefix the Unicode with "\" and print.

Now, we can print different emojis using their corresponding Unicodes. Here are some examples:

# for the grinning face with big eyes
print ('\U0001F603')
# for the winking face 
print('\U0001F609')
# for the kissing face
print('\U0001F617')	

Every emoji has a corresponding Unicode.

Code example

Let’s run the above code in the following code widget, and you can try different Unicode characters to print the desired emoticon.

# for the grinning face with big eyes
print ("\U0001F603")
# for the winking face
print("\U0001F609")
# for the kissing face
print("\U0001F617")

Experiments with different Unicode characters allow us to effortlessly print expressive emojis. This adds a personalized touch and enhances the visual appeal of your scripts, allowing you to convey emotions and expressions seamlessly.

Free Resources