Project

General

Profile

New Model #1201 » convert.py

python script to convert .dat file to .hex binary image - Jens Jensen, 11/07/2013 11:46 PM

 
#!/usr/bin/python
import sys

infile = sys.argv[1]
outfile = sys.argv[2]

fin = open(infile,"r")
filecontents = fin.read()
strlist = filecontents.split()
fin.close()

intlist = map(int, strlist)
bytes = bytearray(intlist)

fout = open(outfile, "wb")
fout.write(bytes)
fout.close()

(3-3/3)