unicode question...

Bjorn Pettersen bjorn at roguewave.com
Tue Nov 7 14:46:07 EST 2000


I'm on Win2k and would like to print a couple of unicode characters to a
file so I can open them in another application to view them. My current
attempts have not been successful...

Help?

-- bjorn

>>> print unichr(321)

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
UnicodeError: ASCII encoding error: ordinal not in range(128)
>>> s
u'\u0141\u0142'
>>> fp = open('foo.txt','w')
>>> fp.write(s)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
UnicodeError: ASCII encoding error: ordinal not in range(128)




More information about the Python-list mailing list