how to write a unicode string to a file ?

Discussion in 'Python' started by Stef Mientki, Oct 16, 2009.

  1. Stef Mientki

    Stef Mientki Guest

    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
     
    Stef Mientki, Oct 16, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mimi
    Replies:
    0
    Views:
    354
  2. Rob Knop
    Replies:
    1
    Views:
    311
  3. Benjamin Kaplan

    Re: how to write a unicode string to a file ?

    Benjamin Kaplan, Oct 16, 2009, in forum: Python
    Replies:
    1
    Views:
    599
    Paul Boddie
    Oct 16, 2009
  4. Donn
    Replies:
    2
    Views:
    338
  5. Stef Mientki
    Replies:
    0
    Views:
    734
    Stef Mientki
    Oct 17, 2009
Loading...

Share This Page