Answer the question
In order to leave comments, you need to log in
How to force Cyrillic output from raw_input() to console in Python2.7?
I can't figure out how in python2.7 to display Russian letters in a user information request, that is, raw_input(" Here! "). I found this way, but it doesn't work for me:
# -*- coding: utf- 8 -*-
import codecs, sys
outf = codecs.getwriter('cp866')(sys.stdout, errors='replace')
sys.stdout = outf
# Не работает на русском все равно
age = raw_input(u"Сколько тебе лет? ")
height = raw_input(u"Каков твой рост? ")
weight = raw_input(u"Сколько ты весишь? ")
print u"Итак, тебе %r лет, в тебе %r см роста и %r кг веса." % (
age, height, weight)
Answer the question
In order to leave comments, you need to log in
outf = codecs.getwriter('utf-8')(sys.stdout, errors='replace')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question