?
=?windows-1251?b?xeLj5e3o6SDK7vHl7eru?=
Hi!
The next program
f = file("content.new", "wb")
print f.encoding
f.write(u"Ïðèâåò")
Gives the next results:
sys:1: DeprecationWarning: Non-ASCII character '\xcf' in file xp.py on line
10, but no encoding declared; see http://www.python.org/peps/pep-0263.html
for details
None
Traceback (most recent call last):
File "xp.py", line 10, in ?
f.write(u"Ïðèâåò")
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5:
ordinal not in range(128)
I use here Russian letters, and need special encoding for them. The property
'encoding' is read-only, and is None by default. How to cast the encoding for
a file?
The next program
f = file("content.new", "wb")
print f.encoding
f.write(u"Ïðèâåò")
Gives the next results:
sys:1: DeprecationWarning: Non-ASCII character '\xcf' in file xp.py on line
10, but no encoding declared; see http://www.python.org/peps/pep-0263.html
for details
None
Traceback (most recent call last):
File "xp.py", line 10, in ?
f.write(u"Ïðèâåò")
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5:
ordinal not in range(128)
I use here Russian letters, and need special encoding for them. The property
'encoding' is read-only, and is None by default. How to cast the encoding for
a file?