Emoji's language is the worldās fastest-growing language and there are more than 3000 emojis. So Why not start using emoji in our python program. In this article, you will learn how to use emoji in python.
For using emoji in python we need to install an emoji
library, so open your command prompt and run this command.
pip install emoji
This Command will install the emoji
library on your computer and now you are ready to use emoji in your python program.
This library uses an emoji cheat sheet to display emoji of that particular cheat._ Cheat Sheet
>>> import emoji
#This command will import emoji library in your program
>>> print(emoji.emojize('Give a :thumbs_up: to this article.'))
Give a š to this article.
>>> print(emoji.emojize('Give a :red_heart: to this article.'))
Give a ā¤ to this article.
By default, you can only use few emojis from the cheat sheet but for using the complete list you need to add emoji.emojize(use_aliases=True)
in your code, this is how we do that.
>>> import emoji
>>> print(emoji.emojize('Are you feeling :angry:', use_aliases=True))
Are you feeling š
>>> print(emoji.emojize('Dont forget to wear your :mask:', use_aliases=True))
Dont forget to wear your š·
That's it for this article, this is my third article so share some feedback to improve in the comment section.
Top comments (2)
Oh go on then, since you asked :)
I'm not a fan of emoji in general for these reasons (and others). In your example, I can only infer the "mask" one by context because to me it looks like a generic smiley, and the one that's defined as
:red_heart:
is... a white heart. And I'm not overrinding any fonts or anything clever like that. They're just not reliable for anything other than the most trivial case, and I'd steer clear of using them for any, shall we say, "professional" product because they might turn out to be unexpectedly inappropriate on some systems.thanks for pointing out the mistake I have not thought about that