readline() with arbitrary end of lines

Keith Ray k_j_r_a_y at ix.netcom.com
Tue Sep 12 21:43:10 EDT 2000


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

>Manuel Gutierrez Algaba <thor at localhost.localdomain> wrote:
>
>> On Sun, Javier Bezos <see.below at no.spam.es> 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.

-- 

       <http://pw2.netcom.com/~kjray/>



More information about the Python-list mailing list