Bob
sorry, I misread your email and thought it said "read on" if the
file was FORMATTED. It wasn't so I didn't (but should have). I read
the complete thread and it is getting a little messy so I have
extracted your questions and added some answers.
I'd like to examine the file myself. We might save a lot of time and
energy that way. If it is not very large would you attach it to your
reply. If it is very large you could either copy just the first 1000
or so bytes, or send the whole thing thru www.yousendit.com.
The file is around 800 Mb but I can't get hold of it until next week
so suggest starting a new topic once I have a cut-down copy.
Well, did you read on? What reactions do you have?
I did (finally) read on and I am still a little confused, though less
than before. I guess the word UNFORMATTED means that the file has no
format .... though it presumably has some structure? One
major hurdle is that I am not really sure about the difference
between a Python binary file and a FORTRAN UNFORMATTED file so any
pointers would be gratefully received
The file looks like (where b = blank) (how it would look in notepad):
bbDISTANCEbbbbbb10bFbbb0.00bbb1.00bbb2.00 If you analyze this with 2s8s2si2s1s
you will see 2s matches bb, 8s matches DISTANCE, 2s matches bb, i
matches bbbb. (\x40\x40\x40\x40). The i tells unpack to shove those
4 bytes unaltered into a Python integer, resulting in 538976288. You
can verify that:
>>> struct.unpack('i', ' ')
(538976288,)
Please either assure me you understand or are prepared for a more in
depth tutorial.
I now understand why Python gave me the results it did ... it looks
like reading the FORTRAN file will be a non-trivial task so probably
best to wait until I can post a copy of it.
Thanks for your help
Alun Griffiths
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor