File: binary_to_hex.py

package info (click to toggle)
clustershell 1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,236 kB
  • sloc: python: 12,990; yacc: 2,844; makefile: 7
file content (11 lines) | stat: -rw-r--r-- 154 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/python

import sys

f = open("foo.gz", "rb")
data = f.read(1)
while data:
    sys.stdout.write("%02x" % ord(data))
    data = f.read(1)
print