John wrote:
> f2=file(infile,'rb')
>
> Dfmt=['3i','13s','7i','2f','2i','2f','2i','i'] #format for binary
> reading first bits
>
> if f2:
> print infile + ' has been opened'
> #for ft in Dfmt:
> # print ft
> a=(struct.unpack(ft,f2.read(struct.calcsize(ft))) for ft in Dfmt)
>
"John" <[EMAIL PROTECTED]> wrote
>a=(struct.unpack(ft,f2.read(struct.calcsize(ft))) for ft in Dfmt)
>for ln in a: print ln
>
> Which gives me:
>
> /cygdrive/c/washakie/binfile has been opened
> (21, 20060612, 0)
> ('Version 4.3',)
> (21, 12, -86400, -86400, -900, 12, 24)
>
> however, how c
Hello,
I have an unformatted mixed type binary file I'm trying to read into Python.
So far, I've gotten as far as:
f2=file(infile,'rb')
Dfmt=['3i','13s','7i','2f','2i','2f','2i','i'] #format for binary reading
first bits
if f2:
print infile + ' has been opened'
#for ft in Dfmt:
#