readline() with arbitrary end of lines

Keith Ray k_j_r_a_y at
Wed Sep 13 03:43:10 CEST 2000

In article <1egsqhc.ph49wqe6hmf4N%see.below at>, 
see.below at (Javier Bezos) wrote:

>Manuel Gutierrez Algaba <thor at localhost.localdomain> wrote:
>> On Sun, Javier Bezos <see.below at> wrote:
>> >Hello,
>> >
>> >I'm using MacPython 1.5.2c1 to read several files with
>> >the help of readline(). However, the files to be read can
>> >have either Mac or Unix end of lines and it seems that only
>> >Mac end of lines are recognized; changing linesep has no
>> >effect at all.
>I think that I can define a class with a buffer, so that I
>can analyze the contents and then extract the lines. What a
>complication for such a simple task!

You _could_ find the relevant code in the Python sources, and add code 
to permit you to specify a newline string, or have the software guess 
the newline string from the file's contents.

Hopefully, once it is working, that new code could be added to the 
standard python source tree.



More information about the Python-list mailing list