42
Printing emojisπππππ in python ππ
Have you ever thought of inserting emojis into your python program? Well, if you haven't, you should start thinking of inserting one into some of your mini projects to make it funπ.
Emojis are now everywhere, even in programming now.
In python now, there are three ways you could insert an emoji.
Emojis are now everywhere, even in programming now.
In python now, there are three ways you could insert an emoji.
emoji
moduleEvery emoji we use when chatting all have unicodes and we can use these unicodes in python to output these same emoji.
Codes
Codes
# face with tears of joy
print("\U0001f602")
# face with tongue
print("\U0001f61b")
Output
π
π
π
π
For the full emoji list, visit Link
Replace the "+" with "000". So "U+1F602" becomes "U0001F602".
Replace the "+" with "000". So "U+1F602" becomes "U0001F602".
Emojis also have CLDR short names. All the short names are provided in the link above.
Code
# face with tears of joy
print("\N{face with tears of joy}")
# face with tongue
print("\N{face with tongue}")
Output
π
π
π
π
To install the module, run
We will use the CLDR short names here by using the
Code
pip install emoji
in your terminal.We will use the CLDR short names here by using the
emojize()
function. All spaces the the CLDR short names would be replaced by an underscore.Code
# Import the module
import emoji
print(emoji.emojize("Python is :thumbs_up:")
print(emoji.emojize("I :red_heart: python")
Output
Python is π
I β€οΈ python
Python is π
I β€οΈ python
42