P
P
Porto_b2020-06-20 09:24:47
Python
Porto_b, 2020-06-20 09:24:47

How to output Cyrillic in Python?

I am solving problems from the HelloWorld book in Python and there is the following code:

import easygui
flavor = easygui.enterbox('Ваше любимое мороженное?',
                          default = 'Ванильное')
easygui.msgbox('Вы указали ' + flavor)

When you start the interpreter, instead of Cyrillic, crack images
5eedab91ef607731577780.jpeg

How can this problem be solved without crutches?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Gornostaev, 2020-06-20
@Porto_b

I don't know what easygui is, but it's probably just to use Python 3 and make sure the script is UTF-8 encoded.

I
Ivan Solomennikov, 2020-06-20
@ivsol

There are no problems with Cyrillic in python3, try saving the file in utf8.
5eedb1a0ebb8d502485058.png

S
StudMG, 2020-06-20
@StudMG

Try adding a line at the beginning of the file with the executable code
# -*- coding: utf-8 -*-
. This will change the file encoding to utf-8. Most likely your characters are translated automatically into ascii or cp1251.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question