Reputation: 45
I want to print the green heart with this script: print('\u1F49A')
. But it shows ὉA`. So what went wrong and what is the right way to print the green heart?
Upvotes: 1
Views: 1187
Reputation: 92460
'\u1F49'
is Greek Capital Letter Omicron with Dasia: Ὁ
. '\u1F49A'
is that same character plus an A
literal. This is because \u
expects a 16-bit hex value, or 4 hex characters. If you want to pass in a larger value you need to use capital \U
and pass in the full 32-bit hex value:
print('\U0001F49A')
# 💚
See the python docs for more info
Upvotes: 4