How to add emoji in Python code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

How to add emoji in Python code

22nd Oct 2019, 2:37 PM
\Dante/
\Dante/ - avatar
13 Answers
+ 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.
22nd Oct 2019, 2:49 PM
Lothar
Lothar - avatar
+ 7
from sys import stdout stdout.reconfigure(encoding="utf-16") it will work. after you can just print directly like: print('🎊')
22nd Oct 2019, 2:55 PM
★«D.Connect_Zone»
★«D.Connect_Zone» - avatar
+ 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.
22nd Oct 2019, 2:49 PM
★«D.Connect_Zone»
★«D.Connect_Zone» - avatar
22nd Oct 2019, 2:56 PM
\Dante/
\Dante/ - avatar
+ 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
23rd Oct 2019, 8:11 AM
Humayra🇧🇩
Humayra🇧🇩 - avatar
22nd Oct 2019, 2:43 PM
A͢J
A͢J - avatar
+ 1
★«D.Connect_Zone» can I import it in SL?
22nd Oct 2019, 2:51 PM
\Dante/
\Dante/ - avatar
+ 1
Nope , not available.
22nd Oct 2019, 2:52 PM
★«D.Connect_Zone»
★«D.Connect_Zone» - avatar
23rd Oct 2019, 6:31 PM
\Dante/
\Dante/ - avatar
+ 1
print ( ;) )
26th Oct 2019, 1:24 PM
Zahra z
Zahra z - avatar
0
What does the stdout module do exactly? (just because I want to understand properly)
23rd Oct 2019, 5:45 PM
ninkelea
23rd Oct 2019, 6:45 PM
ninkelea
0
how to print emoji on python shortcut
10th Feb 2020, 8:54 AM
Afenikhena Favour
Afenikhena Favour - avatar