我有一个脚本显示
UnicodeEncodeError: 'ascii' codec can't encode character u'\u044e' in position 0: ordinal not in range(128)
为线print ord(u), u
。我怎样才能正常运行脚本?
我跑C:\Python27\pythonw.exe name.py
。
# -*- encoding: utf-8 -*-
print "Russian letters".center(18*4)
i = 0
for c in "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"\
"абвгдежзийклмнопрстуфхцчшщъыьэюя":
u = unicode(c, 'koi8-r')
print ord(u), u
i += 1
if i % 4 == 0:
print