file position *tell()* works different

Eric Brunel eric.brunel at pragmadev.N0SP4M.com
Mon Sep 22 04:26:13 EDT 2003


M-a-S wrote:
> "Eric Brunel" <eric.brunel at pragmadev.N0SP4M.com> wrote in message news:bkemib$bjr$1 at news-reader2.wanadoo.fr...
> 
>>Sorry, but no you can't: the default is to open the file in text mode, and you
>>can change it with a 'b', but 't' has no meaning at all. BTW, 'b' also has no
>>meaning at all on all Unices: the so-called "binary" or "text" mode are the
>>same, i.e. what is read is what is in the file. Windows needs it only because of
>>its superfluous \r's at the end of each line.
>><...>
>>HTH
>>-- 
>>- Eric Brunel <eric dot brunel at pragmadev dot com> -
>>PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
> 
> 
> 
> The idea was to tell the humans that it's text. It won't hurt neither Unix nor Windows.
> I know that nobody cares, though.

Not only to tell humans: Windows automatically removes the '\r' at the end of 
each line when a file is opened in text mode. It won't happen in binary mode.

And I wish I could stop caring, but I occasionally run into problems just 
because of this behaviour, and I know I'm not the only one.
-- 
- Eric Brunel <eric dot brunel at pragmadev dot com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com





More information about the Python-list mailing list