Afonso Hipólito
Afonso Hipólito

Reputation: 97

Emoji module Python

I'm trying to make a rock/paper/scissors game in Python and I want to print some emojis representing "rock", "paper" and "scissors". I downloaded emoji module and then I imported it in my code. However, when I try to use the function and write the emoji (eg: :fist:), it prints exactly ":fist:" and not a fist emoji. I wanted to print three emojis, ":fist:", ":v:" and ":raised_hand:", but only ":raised_hand:" works.

I've tried to change emojis but some work and some don't.

Here's my code:

import emoji
print(emoji.emojize(":fist:"))
print(emoji.emojize(":v:"))
print(emoji.emojize(":raised_hand:"))

I hope you can help me with this. Thank you.

Upvotes: 2

Views: 1610

Answers (1)

sanyassh
sanyassh

Reputation: 8540

You need to use use_aliases=True to get emojis from :fist: and :v::

import emoji
print(emoji.emojize(":fist:", use_aliases=True))
print(emoji.emojize(":v:", use_aliases=True))
print(emoji.emojize(":raised_hand:"))

Output:

✊
✌
✋

:fist: is an alias for :raised_fist: and :v: is an alias for :victory_hand: so you can also use these full names:

import emoji
print(emoji.emojize(":raised_fist:"))
print(emoji.emojize(":victory_hand:"))
print(emoji.emojize(":raised_hand:"))

Output will be the same.

Upvotes: 3

Related Questions