Created
March 1, 2015 06:36
-
-
Save curzona/00aa5e50fa2f59629a6c to your computer and use it in GitHub Desktop.
unix od in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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