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

 
1
#!/usr/bin/python
2
import sys
3

    
4
infile = sys.argv[1]
5
outfile = sys.argv[2]
6

    
7
fin = open(infile,"r")
8
filecontents = fin.read()
9
strlist = filecontents.split()
10
fin.close()
11

    
12
intlist = map(int, strlist)
13
bytes = bytearray(intlist)
14

    
15
fout = open(outfile, "wb")
16
fout.write(bytes)
17
fout.close()
18

    
(3-3/3)