how to write a unicode string to a file ?

Stef Mientki stef.mientki at gmail.com
Fri Oct 16 01:43:46 CEST 2009


hello,

By writing the following unicode string (I hope it can be send on this 
mailing list)

    Bücken

to a file

     fh.write ( line )

I get the following error:

  UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in 
position 9: ordinal not in range(128)

How should I write such a string to a file ?

thanks,
Stef Mientki




More information about the Python-list mailing list