from __future__ import with_statement import struct import sys def convert(input, output): with open(input, "r") as in_file: with open(output, "w") as out_file: def build_dic(parts): dic = {} for part in parts: key, value = part.split('=') try: dic[key] = int(value) except: dic[key] = value return dic def get_entry(line): parts = line.split() type = parts[0] dic = build_dic(parts[1:]) return type, dic def write_int16(val): out_file.write(struct.pack(' " else: print "converting..." convert(sys.argv[1], sys.argv[2]) print "done!"