How to print emojis using CLDR short names in Python

Overview

An emoji is a pictogram, logogram, ideogram, or smiley embedded in 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 CLDR short names. Some CLDR short names include:

  • smiling face
  • grinning face
  • winking face
  • kissing face with closed eyes
  • kissing face with smiling eyes
  • squinting face with tongue
  • zany face

How to print emojis using the CLDR short name

To print emojis using the CLDR short name, you prefix the CLDR short name with \N and then enclose it a curly brace {}

Example

Now, let’s write some lines of code that will print some emojis using the CLDR short names:

# for the winking face emoji
print('\N{winking face}')

# for the kissing face with closed eye emoji
print('\N{kissing face with closed eyes}')

# for the kissing face with smiling eyes emoji
print('\N{kissing face with smiling eyes}')

Output

πŸ˜‰
😚
πŸ˜™

Note: Every emoji has a corresponding CLDR short name.

Free Resources