Re: writing to a binary file without intervening spaces

2008-03-18 Thread Paul Rubin
Larry <[EMAIL PROTECTED]> writes: > I even went further to opening the file using notepad, and did a > search-and-replace for space characters. The result was what I > desired: data,data,data... In Windows, you also have to make sure to open binary files in binary mode. -- http://mail.python.org/

Re: writing to a binary file without intervening spaces

2008-03-17 Thread Larry
On Mar 18, 1:32 pm, Paul Rubin wrote: > Larry <[EMAIL PROTECTED]> writes: > > It seems to me that Python always add intervening spaces between data > > elements when writing to a file > > It's just the print statement that does that. I doubt that. I tried one small file,

Re: writing to a binary file without intervening spaces

2008-03-17 Thread Paul Rubin
Larry <[EMAIL PROTECTED]> writes: > It seems to me that Python always add intervening spaces between data > elements when writing to a file It's just the print statement that does that. -- http://mail.python.org/mailman/listinfo/python-list

Re: writing to a binary file without intervening spaces

2008-03-17 Thread Larry
Thanks to all those who responded to this query. It seems to me that Python always add intervening spaces between data elements when writing to a file. Even with tostring() of numpy, array elements get separated by space character. I like the output of sys.stdout.write(file) to be writen as is to

Re: writing to a binary file without intervening spaces

2008-03-17 Thread castironpi
On Mar 17, 3:28 am, Paul Rubin wrote: > Larry <[EMAIL PROTECTED]> writes: > > My data is a = [23, 45, 56, 255]. > > My desire output is: 234556255, of course in binary file > > representation already. > > > I tried to make one using write after pack method of struct modul

Re: writing to a binary file without intervening spaces

2008-03-17 Thread Paul Rubin
Larry <[EMAIL PROTECTED]> writes: > My data is a = [23, 45, 56, 255]. > My desire output is: 234556255, of course in binary file > representation already. > > I tried to make one using write after pack method of struct module, > but because of spaces I got incorrect results. struct.pack works for

writing to a binary file without intervening spaces

2008-03-16 Thread Larry
Dear all, I need to write integer values to a binary file that will be read by another application, specifically ENVI. I want to write these values without intervening spaces between values. For example: My data is a = [23, 45, 56, 255]. My desire output is: 234556255, of course in binary file rep