EOL created by .write or .encode

Fredrik Lundh fredrik at pythonware.com
Sat Apr 9 04:04:32 EDT 2005


"Xah Lee" <xah at xahlee.org> wrote:

> Why is that some of my files written out by
>    outF.write(outtext.encode('utf-8'))
> has ascii 10 as EOL, while others has ascii 13 as EOL?

>    outF = open(tempName,'wb')
>    outF.write(outtext.encode('utf-8'))
>    outF.close()

UTF-8 is not a binary format.  get rid of the "b" flags, and things
will work as expected.

</F> 






More information about the Python-list mailing list