Skip to content

Instantly share code, notes, and snippets.

@curzona
Created March 1, 2015 06:36
Show Gist options
  • Select an option

  • Save curzona/00aa5e50fa2f59629a6c to your computer and use it in GitHub Desktop.

Select an option

Save curzona/00aa5e50fa2f59629a6c to your computer and use it in GitHub Desktop.
unix od in python
data = open("myfile", "rb").read()
width = 16
lines = [data[i:i+width] for i in range(0, len(data), width)]
print "\n".join([" ".join(map(lambda x: "%02X" % x, map(ord, line))) for line in lines])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment