+ 8
How to add emoji in Python code
13 Respuestas
+ 13
hi, in regular IDE it should not be a problem to insert emojis by keyboard or copy paste most characters. In playground, you need to put some code on top of the file to avoid error messages during execution:
import sys
import codecs
sys.stdout = codecs.getwriter('utf_16')(sys.stdout.buffer, 'strict')
Individual chars can also be placed like this:
print(u"\u03A9")
to know which character has which code, you can use a unicode app, most of them are free of cost.
+ 7
from sys import stdout
stdout.reconfigure(encoding="utf-16")
it will work.
after you can just print directly like:
print('🎊')
+ 4
There is module :
emoji
Install it by:
pip install emoji
To start using it in program:
from emoji import emojize
print(emojize(':thumbs_up:'))
Here, in sololearn will not work tho.
If you want to show like those here:
USE:
from sys... encode utf-16... i forgot the code actually need to see.
+ 3
★«D.Connect_Zone» thanks
+ 3
You can use in a large scale too
But, you have to copy-paste the emoji to the code, as the keyboard doesn't support emoji in code playground
https://code.sololearn.com/cK0top56CXgL/?ref=app
+ 2
Check this code
https://code.sololearn.com/cH0lSgaEq8YR/?ref=app
+ 1
★«D.Connect_Zone» can I import it in SL?
+ 1
Nope , not available.
+ 1
Mirielle🐶 [Inactive] thank you
+ 1
print ( ;) )
0
What does the stdout module do exactly? (just because I want to understand properly)
0
Mirielle🐶 [Inactive] Thanks🐱
0
how to print emoji on python shortcut