writing to a binary file without intervening spaces

Larry larry.cebuala at gmail.com
Mon Mar 17 02:37:04 EDT 2008


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
representation already.

I tried to make one using write after pack method of struct module,
but because of spaces I got incorrect results. ENVI asks what data
type I have and from that gets a sequence of bytes to "form" the data.
With spaces, I think this gave me the problem.

Thanks.




More information about the Python-list mailing list