Read / Write image file

Scott David Daniels Scott.Daniels at Acm.Org
Wed May 4 11:52:43 EDT 2005


phil wrote:
>>
>> By the way, what is 'rb' and 'wb' ?
>>
> 
> Read Binary, Write Binary
> In Win32 the default is text mode which
> will screw up binary files
> 
In fact, this is not just for Windows.  Linux / Unix is unusual
using the originally non-standards-conforming line feed ('\n')
character as a line separator.  Various different OS's define
text files in different ways.  The distinction between binary
and text is a C standards thing, not a Windows goof.  Heaven
knows I dislike a lot of what Microsoft has done in the way
of interfering with standard ways of doing things, but their
end-of-line convention is not one of those things.  The use
of the extension ".doc" was such a deliberate violation of
standards.  Note older Apple files used '\r' as a line separator,
Tenex used \r\n, or \037, some systems used a line count (leaving
no end-of-line string), and so on....

It is a good idea to provide an indication of whether a file
is binary or text to the file system; the clue could guide
compression information.

-Scott David Daniels
Scott.Daniels at Acm.Org





More information about the Python-list mailing list