writing binary file for different platform

Marcus Stojek stojek at part-gmbh.de
Fri May 10 09:05:46 EDT 2002


Hi,
I have to write a binary file that will be read by a FORTRAN routine.
This is no problem if writing the file and reading with FORTRAN is
done on the same platform (Windows im my case).

Now I have to prepare such a binary file on my Win system that will
be read on an IBM machine (IBM AIX 4.3.3.25)

>From the doc I guess that I have to add a character to the format
string (e.g. '<' or '>' ). If this is correct then please could
someone tell me which one. If not then what else can i do ?

Thanks in advance,
Marcus
#--------------------------------
import struct
i=1
x=1.5
y=2.3
z=-0.2
fa=open(outfile,"wb")
fa.write("%s"%(struct.pack("ifff",i,x,y,z)))
fa.close()



More information about the Python-list mailing list