# -*- coding: utf-8 -*- res = [] res_1 = [] testline = 'привет' testline_1 = u'привет' for i in testline: res.append(i) for b in testline_1: res_1.append(b) print res print res_1 print testline print testline_1
и вот собственно результат:
['\xd0', '\xbf', '\xd1', '\x80', '\xd0', '\xb8', '\xd0', '\xb2', '\xd0', '\xb5', '\xd1', '\x82'] [u'\u043f', u'\u0440', u'\u0438', u'\u0432', u'\u0435', u'\u0442'] привет привет
# -*- coding: cp1251 -*- res = [] res_1 = [] testline = 'привет' testline_1 = u'привет' for i in testline: res.append(i) for b in testline_1: res_1.append(b) print res print res_1 print testline print testline_1
здесь такая картинка получается
['\xef', '\xf0', '\xe8', '\xe2', '\xe5', '\xf2'] [u'\u043f', u'\u0440', u'\u0438', u'\u0432', u'\u0435', u'\u0442'] привет привет
Помогите победить!!!