+ 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!

1st Oct 2018, 3:10 PM
Mariann Margitics
Mariann Margitics - avatar
5 Respuestas
+ 12
Try adding these lines at the beginning of your code: import sys, codecs sys.stdout = codecs.getwriter('utf-16')(sys.stdout.buffer, 'strict')
1st Oct 2018, 3:28 PM
Anna
Anna - avatar
+ 4
Thank you so much, Anna! You saved me hours of googling. It works perfectly now! :)
1st Oct 2018, 3:35 PM
Mariann Margitics
Mariann Margitics - avatar
+ 4
Freut mich zu hören 😊
1st Oct 2018, 3:35 PM
Anna
Anna - avatar
+ 4
import sys, codecs sys.stdout = codecs.getwriter('utf-16')(sys.stdout.buffer, 'strict') print("Vielen Dank nochmal, Anna!\nLiebe Grüße aus Berlin! :)")
1st Oct 2018, 3:43 PM
Mariann Margitics
Mariann Margitics - avatar
+ 3
Hola buenas.. alguien que ayude en pytnon.?
2nd Oct 2018, 8:03 AM
Sergio Pérez moreno
Sergio Pérez moreno - avatar