Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Call with input and output files as arguments, for example:
- # $ bits.py res/GBK32.FON res/GKB32.processed
- import sys
- def copyByte(input_, output):
- byte = input_.read(1)
- if len(byte) == 0:
- return False
- bits_str = '{0:08b}'.format(ord(byte)).replace('0', ' ').replace('1', '#')
- bits = bits_str.encode('ascii')
- output.write(bits)
- return True
- with open(sys.argv[1], 'rb') as inf:
- with open(sys.argv[2], 'wb') as outf:
- while copyByte∞:
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement