I am opening up a binary file like so:
file = open(\"test/test.x\", \'rb\')
and reading in lines to a list. Each line looks a little like:
To print it, you can do something like this:
print repr(data)
For the whole thing as hex:
print data.encode('hex')
For the decimal value of each byte:
print ' '.join([str(ord(a)) for a in data])
To unpack binary integers, etc. from the data as if they originally came from a C-style struct, look at the struct module.