sys.getdefaultencoding()
-> utf8
test = u'tempête'
test
-> u'temp\xc3\xaate'
print(test)
-> tempête # WTF ?
sys.setdefaultencoding('ascii')
sys.getdefaultencoding()
-> ascii
test = u'tempête'
test
-> u'temp\xc3\xaate'
print(test)
-> tempête #...
Я наблюдаю эти результаты, когда делаю set_trace() из pdb.
В оболочке python2.7 у меня правильный результат:
sys.getdefaultencoding()
-> ascii
test = u'tempête'
test
-> u'temp\xc3\xaate'
print(test)
-> tempête # WTF ?
Я борюсь с этим часами...
AttributeError: 'NoneType' object has no attribute 'CodecInfo'
- person zondo   schedule 24.02.2016reload(sys)
заставить эту работу работать, что должно сказать вам, что с ней нельзя играть. - person Alastair McCormack   schedule 25.02.2016