Print emojis using python (😀, 👍, ...)

Hello World,

Everyone of us usage the emojis at some point, because its quiet expressive. and when you are a programmer then it becomes more curious to print emoji characters out.


I thought of printing emojis out for the logs, most of the time when I used to print the logs specially for the errors or exception message then I always try to express the message with more expression


Well, you can print emojis using python as well. For that we can follow one of the following things:
1- Unicodes
2- Library

1- Unicodes: There are unicodes for every single character that is going to be printed out and that's why there are unicodes for the emojis too.

For example: Unicode for thumbs up is "U+1F44D" which in python is going be be as "U0001F44D". As you have noticed that we are replacing "+" with "000", and not only that we also append "\" in front of this unicode while printing.

So finally the thumb up emoji can be printed with:
print("\U0001F44D") ===> 👍


2- Library: There is a library called "emoji" that you need to install it.
pip install emoji
and then simply follow their documentation to use it seamlessly.

Follow the library: https://pypi.org/project/emoji/

Comments

Popular posts from this blog

Scraping with Python

Html Status Code