Is there a way I can display a simple emoji character in my Python script using print? print('🙄') gives me an error everytime | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is there a way I can display a simple emoji character in my Python script using print? print('🙄') gives me an error everytime

When I try to print an emoji, the Python script yields a "UnicodeEncodeError". Looking for a way around this.

5th Mar 2019, 3:09 AM
D. Booey 📜
D. Booey 📜 - avatar
1 Answer
+ 2
import sys, codecs sys.stdout = codecs.getwriter('utf_16')(sys.stdout.buffer, 'strict') print(chr(128580)) Your emoji is U+1F644 (base 16, ignore "U+", which equals 128580 (base 10). https://unicode.org/emoji/charts/full-emoji-list.html https://code.sololearn.com/csTae6tX7D4l/?ref=app
5th Mar 2019, 4:18 AM
Diego
Diego - avatar