+ 6
How is it possible to print the Hungarian vowels á, é, í, ó, ö, ő, ü, ű, plus the capital version of these, and ß in Python?
I get totally different characters on my Android device for these accented vowels and for the German ß in the output. What code do I need to add concretely in order to see the right accented vowel in the output? I'm also interested in Spanish, Portuguese and French characters like ñ, ç or ê. Thank you so much for your help!
5 Antworten
+ 12
Try adding these lines at the beginning of your code:
import sys, codecs
sys.stdout = codecs.getwriter('utf-16')(sys.stdout.buffer, 'strict')
+ 4
Thank you so much, Anna! You saved me hours of googling. It works perfectly now! :)
+ 4
Freut mich zu hören 😊
+ 4
import sys, codecs
sys.stdout = codecs.getwriter('utf-16')(sys.stdout.buffer, 'strict')
print("Vielen Dank nochmal, Anna!\nLiebe Grüße aus Berlin! :)")
+ 3
Hola buenas.. alguien que ayude en pytnon.?