![]() | Ned Batchelder : Blog | Code | Text | Site hexdump.py » Home : Code : Shell Utils |
Created 2 October 2002, last updated 24 April 2008 A simple script to show the contents of a file in hex. $ hexdump 256.datDownload: hexdump.py Thanks to Tim Hatch and David Earlam for improvements! Need some binary data to view? Try ramp.py. | |
Comments
To run under both Python 3.0 and 2.5, I made the following changes. The root issue is that when a file is opened in binary mode under Python 3.0, reading it produces bytes and not a character string.
71 if type(c) != type(int()): 72 c = ord(c) 73 hex = hex + ("%02x" % (c)) + " " 74 asc = asc + ascmap[c]Add a comment: