[Tutor] [tutor] how to cast to stucture

Kent Johnson kent37 at tds.net
Tue Sep 5 19:35:34 CEST 2006


emilia12 at mail.bg wrote:
> Hi list,
>
> i have a complex data in binary file and i want to read its
> fields... the C way is to read file in buffer and then cast
> it to proper structure. Is there a way to do the same in
> Python or i have to read the data byte by byte ?

As well as the struct module you might want to look at pyconstruct which 
is a bit higher-level.
http://pyconstruct.wikispaces.com/

Kent



More information about the Tutor mailing list