Steven D'Aprano wrote:
[Generally fine stuff, I am elaborating rather than dis-agreeing.]
On Sun, 12 Mar 2006 22:01:46 -0500, John Salerno wrote:
Erik Max Francis wrote:
You can use the struct module for converting fundamental types to a
portable string representation for writing to binary
In C#, writing to a binary file wrote the actual data types into the
file (integers, etc.). Is this not how Python binary files work? I tried
to write integers into a file, but the write method only takes a string
argument anyway.
Is there a way to actually store integers in a file, so that
John Salerno wrote:
In C#, writing to a binary file wrote the actual data types into the
file (integers, etc.).
This was inherently nonportable.
Is this not how Python binary files work? I tried
to write integers into a file, but the write method only takes a string
argument anyway.
Erik Max Francis wrote:
You can use the struct module for converting fundamental types to a
portable string representation for writing to binary files.
But if it's a string, why not just use a text file? What does a binary
file do that a text file doesn't, aside from not converting the end
On 2006-03-13, John Salerno [EMAIL PROTECTED] wrote:
You can use the struct module for converting fundamental types
to a portable string representation for writing to binary
files.
But if it's a string, why not just use a text file?
Because string != text.
In Python a string is just an
Grant Edwards [EMAIL PROTECTED] wrote:
...
What does a binary file do that a text file doesn't, aside
from not converting the end of line characters?
Nothing. It's the end-of-line conversion that can break binary
data.
I believe that a control-Z (ord(26)) in a file that's being read
On Sun, 12 Mar 2006 22:01:46 -0500, John Salerno wrote:
Erik Max Francis wrote:
You can use the struct module for converting fundamental types to a
portable string representation for writing to binary files.
But if it's a string, why not just use a text file? What does a binary
file do
On 2006-03-13, Alex Martelli [EMAIL PROTECTED] wrote:
Grant Edwards [EMAIL PROTECTED] wrote:
...
What does a binary file do that a text file doesn't, aside
from not converting the end of line characters?
Nothing. It's the end-of-line conversion that can break binary
data.
I believe