Aaron Scott wrote:
Taking everything into consideration, my code is now: import struct file = open("test.gde", "rb") signature = file.read(3) version, attr_count = struct.unpack('II', file.read(8)) print signature, version, attr_count for idx in xrange(attr_count): attr_id, attr_val_len = struct.unpack('II', file.read(8)) attr_val = file.read(attr_val_len) print attr_id, attr_val_len, attr_val file.close() which gives a result of: GDE 2 2 1 4 é 2 4 ê Å Essentially, the same results I was originally getting :
It appears that your 4-byte attribute values are not what you were expecting. Do you have separate info on the supposed contents? In any case, I would print repr(attr_val) and even for c in attr_val: print(ord(c)).
tjr -- http://mail.python.org/mailman/listinfo/python-list