1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-12-26 22:31:14 +00:00
8bitworkshop/tools/carr2bin.py

16 lines
317 B
Python

import sys,re
inf = sys.stdin
outf = open('a.out','wb')
l = inf.readline()
while l:
l = l.strip()
if l[-1] == ',':
l = l[0:-1]
toks = re.split('[,\s]+', l)
toks = list(filter(lambda x: x[0:2]=='0x', toks))
arr = [int(x,0) for x in toks]
outf.write(bytes(arr))
l = inf.readline()