Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy
- data = numpy.fromfile('binaryfile', dtype=numpy.uint16)
- for bit in range(16):
- print('Bit', bit)
- text = numpy.empty((len(data) * 2, ), dtype=numpy.uint8)
- text[1::2] = ord('\n')
- text[0::2] = ord('0') + (data & (1 << bit) != 0)
- print(text)
Advertisement
Add Comment
Please, Sign In to add comment