Foreign Character Problems In Python 2.5 and Tkinter

Juha S. jusa.sj at gmail.com
Sun Oct 14 09:23:42 CEST 2007


nickel_and_dime_2death at yahoo.com wrote:
> As a noob I've struggled a bit, but basically what I've come up with
> is => if the information is strings and especially strings stored in
> any style of list/dict, it takes a loop to write the lines to file
> myfile[ i ] + '\n' to keep each line for Python I/O purposes. If
> you're done with Python manipulation and want WIN, MAC, or UNIX to
> begin file I/O, then, you need the consideration of <newline-char>
> from the os module, or code it in yourself, e.g. '\r\n'. The fact you
> are using codec iso-latin-1 (or iso-8859-1) doesn't change the '\n'
> from Python's viewpoint -- that is: '\n' is still '\n'. When your
> efforts are I/O with binary encoding the data, it's all Python's
> viewpoint.
>
>   

Ah, it was so simple. I replaced any '\n' characters with 'os.linesep' 
in the source as you suggested, and now everything works beautifully. 
Thanks for the help, guys!



More information about the Python-list mailing list