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.

New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
πŸ† Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources