Unicode File I/O Grief

Bjorn Pettersen BPettersen at NAREX.com
Thu May 16 14:51:51 EDT 2002


> From: Dale Strickland-Clark [mailto:dale at riverhall.NOTHANKS.co.uk] 
> 
> I simply want to do the following:
> 
> file('C:\\odd.txt', 'wb').write(ucString)
> 
> ...so that I can examine the contents of this (rather long) 
> Unicode string in an editor.
> 
> Can I write it to a file?

I'm far from a Unicode expert, but I believe you need to say
ucString.encode(), optionally passing which encoding you want.

-- bjorn






More information about the Python-list mailing list