# dumpfile.py
# hex dump file listed on command line

import sys
bytes = open(sys.argv[1], 'rb').read()
print '-'*40
print repr(bytes)

print '-'*40
i = 0
while bytes:
    print '[%06d] ' % i,
    bytes, chunk = bytes[4:], bytes[:4]          # show 4-bytes per line
    for c in chunk: print hex(ord(c)), '\t',     # show hex of binary value
    print 
    i += 4

print '-'*40

##for line in open(sys.argv[1], 'rb').readlines():
##    print repr(line)