dealing with binary files

Gerardo Herzig gherzig at fmed.uba.ar
Mon Jan 7 08:48:20 EST 2008


Hi all. Im trying to read a binary data from an postgres WAL archive.
If i make a
xfile = open('filename', 'rb').xreadlines()
line = xfile.next()

i see this sort of thing: 
']\xd0\x03\x00\x01\x00\x00\x00\r\x00\x00\x00\x00\x00\x00JM//DI+,D\x00\x00\x00\x01$\x00\x00\x00\x7f\x06\x00\x00y\r\t\x00\x02\x0f\t\x00\x00\x00\x10\x00)\x00\x01\x00\x12\x08 
\x00^\xc2\x0c\x00\x08\x00\x00\x003001({\xe8\x10\r\x00\x00\x00\xe4\xff\xffI\x10?l\x01@\x00\x00\x00$\x00\x00\x00\x00\n'

This file suppose to have some information about database activity, but 
at this point i cant do more than this, because i cant figure out what 
to do in order to have some 'readable' text.

Im guessing is some C code, im reading the struct module to see if it 
helps, but im not into C programming, and im lost at the start of my 
problem.

Can someone point me out some advice?
Thanks!

Gerardo



More information about the Python-list mailing list