#!/usr/bin/python # Pipe file into this to display the binary values of each byte in the file # Author: zoredache import sys while 1: # grab a line from input line = sys.stdin.readline() if not line: break # loop across all the characters in a line for i in range(len(line)): # int value of character charval=ord(line[i]) # string displaying the binary value binval=''.join([str((charval >> y) & 1) for y in range(7,-1,-1)]) # print the results print "%s = %s" % ( binval, str(charval))