Reading binary data

Aaron Scott aaron.hildebrandt at
Wed Sep 10 20:16:38 CEST 2008

Taking everything into consideration, my code is now:

import struct
file = open("test.gde", "rb")
signature =
version, attr_count = struct.unpack('II',
print signature, version, attr_count
for idx in xrange(attr_count):
	attr_id, attr_val_len = struct.unpack('II',
	attr_val =
	print attr_id, attr_val_len, attr_val

which gives a result of:

GDE 2 2
1 4 é
2 4 ê Å

Essentially, the same results I was originally getting :(

More information about the Python-list mailing list