On Wed, Nov 18, 2009 at 11:42 AM, Ulrich Eckhardt <dooms...@knuut.de> wrote: > Hia! > > I need to read a file containing packed "binary" data. For that, I find the > struct module pretty convenient. What I always need to do is reading a chunk > of data from the file (either using calcsize() or a struct.Struct instance) > and then parsing it with unpack(). For that, I repeatedly write utility > functions that help me do just that, but I can't imagine that there is no > better way for that. > > Questions: > 0. Am I approaching this from the wrong direction? I'm not a programming > noob, but rather new to Python still. > 1. The struct module has pack_into() or unpack_from(), could I somehow > combine that with a file? > 2. Is there some easier way to read files? I know about array and xdrlib, > but neither really fit my desires. > 3. Failing all that, would you consider this a useful addition to the struct > module, i.e. should I write a feature request? > > Thanks! > > Uli
You might look at "Construct": http://construct.wikispaces.com/ ~Simon -- http://mail.python.org/mailman/listinfo/python-list