Reading unformatted big-endian files
John Machin
sjmachin at lexicon.net
Fri Aug 11 07:05:55 EDT 2006
On 11/08/2006 8:35 PM, Andrea Gavana wrote:
> I hope performances will not change so much: fortran is
> very fast in reading files (but I use it only in this case, I love to
> use Python)... well, let's see :-D
<ot> Well FORTRAN would have to have *something* going for it :-)
I vaguely recall in a previous incarnation tarting up a vanilla ratfor
"compiler" with switch statements and macros and all sorts of goodies so
that life was less unbearable :-) [this was *before* f77]
</ot>
Suggestions:
(1) Upgrade to 2.5 as soon as it goes final -- struct's performance has
been improved.
(2) Consider the possibility of not unpacking all three variables if you
don't need to -- for example if you are ignoring everything until you
hit a record that starts with 'DIMENS ', you don't need to unpack
anything, just do:
if buff[:8] == 'DIMENS ':
How big are your files, anyway?
Cheers,
John
More information about the Python-list
mailing list