Oh, and I'm constrained to Python 2.5 or lower only :(<div><br></div><div>Glen</div><div><br><div class="gmail_quote">On Sat, Feb 12, 2011 at 11:19 AM, Glen Jarvis <span dir="ltr"><<a href="mailto:glen@glenjarvis.com">glen@glenjarvis.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I remember, about three years ago, reading someone's answer to a question very similar to this. But, I can't find it now.<div>
<br></div><div>I have a raw input file where the first "entity" is a 64-bit unsigned integer and the remaining items in the file are 32-bit unsigned integers (until the end of the file).</div>
<div><br></div><div>I vaguely remember there was already a module to cleanly handle this. I could, of course, open the file (f) in binary mode and do an f.read() on each byte and figure thing out. But, one will have to think of byte swapping, variable "sizes", etc. when running on different systems.</div>
<div><br></div><div>I thought there was a layer above this that would take care of the mapping of data in the file (i.e., a raw dump/raw read) to a set of variables, taking care of byte swapping if needed, size of types, etc. as long as I specified the format (i.e., first should be 64-bit unsigned, second... etc.)</div>
<div><br></div><div>Am I mistaking that this exists (i.e., did I just make this up)?</div><div><br></div><div>Cheers,</div><div><br></div><div><br></div><div><br></div><div>Glen</div><div><div>-- <br><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">Things which matter most must never be at the mercy of things which matter least.</span><br>
<br>-- Goethe <br>
</div></div>
</blockquote></div><br><br clear="all"><br>-- <br><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">Things which matter most must never be at the mercy of things which matter least.</span><br>
<br>-- Goethe <br>
</div>