using binary in python
Larry Hudson
orgnut at yahoo.com
Tue Nov 10 22:53:18 EST 2015
On 11/10/2015 12:14 PM, Dennis Lee Bieber wrote:
> On Mon, 9 Nov 2015 22:20:25 -0800, Larry Hudson via Python-list
> <python-list at python.org> declaimed the following:
>
>> Of course it can. The only difference a text file and a binary file is the way it's opened.
>> Text files are opened with 'r' or 'w', while binary files are opened with 'rb' or 'wb'. Being
>> different modes, the reading/writing is handled differently. One obvious difference, the lines
>> of a text file are marked by ending them with a newline character, so it's easy to read/write
>> the text line-by-line. But the data in a binary file is completely arbitrary and is much
>
> To be strict -- a text file has <some> system defined means of marking
> line endings. UNIX/Linux uses just a <LF> character; Windows uses the pair
> <CR><LF>. TRS-DOS used just <CR> for end of line. Some operating systems
> may have used count-delimited formats (and then there is the VMS FORTRAN
> segmented records with start and end segment bits).
>
The main purpose of my message was to get across the idea of separating the actual data (as
binary values) and the way this data is displayed (to the user/programmer). They are two
entirely different concepts, and the OP was obviously confused about this. But of course,
you're right -- I was careless/imprecise in some of my descriptions.
-=- Larry -=-
More information about the Python-list
mailing list