[Tutor] file io: reading an int32 at the end of a file?

Marcus Goldfish magoldfish at gmail.com
Wed Jul 6 22:12:59 CEST 2005


I have a file format that ends in a 4-byte (int32) number.  I would
like to read this value in python on a WinXP machine with something

fname = 'somefile'
f = open(fname, 'rb')
offset = f.read()

... but this doesn't seem to work.  The value that Python returns is:


but I know from similar code in Matlab that the correct sequence is:

   64 25 1 0

Can someone point out my error?


More information about the Tutor mailing list