#encoding:utf-8
filename=r'55252+initial+code+for+ctm.c'
_str = 'SSD_SEND(0x11,'
all_line=[]
if __name__ == '__main__':
f = open(filename,'r')
line = f.readline()
while line:
index = line.find(_str)
if index!=-1:
line.strip()
abc = line.split(',')
mtwo = '0x{:02x}'.format(len(abc)-2)
mthree = ','.join(abc[2:]).replace(");","}},")
newline = "{%s,%s,{"%(abc[1],mtwo)+mthree
all_line.append(newline)
line = f.readline()
print(all_line)
f.close()
f1 =open("gencode.txt",'w')
for line in all_line:
f1.write(line)
f1.close()