Re: Reading text files where last line has no EOL

2007-09-17 Thread Gabriel Genellina
En Mon, 17 Sep 2007 09:02:38 -0300, BlueBird <[EMAIL PROTECTED]> escribi�: > Oooops. It was a stupid bug in my script: textLine[:- > int(textLine[-1]=='\n')] is not what I want (the real code was not a > one-liner)! The documentation made me think that something wrong was > going on with pyt

Re: Reading text files where last line has no EOL

2007-09-17 Thread BlueBird
On 17 sep, 13:24, Steve Holden <[EMAIL PROTECTED]> wrote: > BlueBird wrote: > > I tried and failed to read text files where the last line does not > > contain proper EOL. For my tests, I use a file that I create with the > > equivalent of : > > > open('toto', 'w').write( '1234\n4567\n89AB' ) > > >

Re: Reading text files where last line has no EOL

2007-09-17 Thread Steve Holden
BlueBird wrote: > I tried and failed to read text files where the last line does not > contain proper EOL. For my tests, I use a file that I create with the > equivalent of : > > open('toto', 'w').write( '1234\n4567\n89AB' ) > > > My reading code looks like this : > >l = f.readline() >

Reading text files where last line has no EOL

2007-09-17 Thread BlueBird
I tried and failed to read text files where the last line does not contain proper EOL. For my tests, I use a file that I create with the equivalent of : open('toto', 'w').write( '1234\n4567\n89AB' ) My reading code looks like this : l = f.readline() while len(l): self