Newbie lost(new info)
Anton Vredegoor
anton at vredegoor.doge.nl
Wed Feb 25 19:15:47 EST 2004
"John Roth" <newsgroups at jhrothjr.com> wrote:
>For the rest of it, I'd like to see a *real* hex dump in mainframe
>format. From what you've given us so far I'm not certain whether
>the struct module can convert the data for you.
Probably what John wants to see is the output of something like this:
#one 'line' of data (since it's a binary file there is no real line
#ending convention: a line is just a specific number of bytes long,
#it's important to find out how many exactly)
from binascii import hexlify
inf = file('somefile','rb')
data = inf.read(1005) #a 113 bytes string + 232 4 bytes floats
L = map(hexlify,data)
print L
Anton
More information about the Python-list
mailing list