0

1

I have an .hex file looking something like below:

:020000040000FA
:2080000061FC00000000000000000000000000000000000000000000000000000000000003
:20802000000000000000000000000000000000000000000000000000000000000000000040
:208040000000000000000000000000000000000061FC0000000000000000000000000000C3
:20806000000000000000000000000000000000000000000000000000000000000000000000
:208080000000000000000000000000000000000000000000000000000000000000000000E0
:2080A00061FC00000000000000000000000000000000000000000000000000000000000063
:2080C0000000000000000000000000000000000000000000000000000000000000000000A0
:2080E0000000000000000000000000000000000061FC000000000000000000000000000023
:2081000000000000000000000000000000000000000000000000000000000000000000005F
:2081200000000000000000000000000000000000000000000000000000000000000000003F
:2081400061FC000000000000000000000000000000000000000000000000000000000000C2
:208160000000000000000000000000000000000000000000000000000000000000000000FF
:040000050000940063
:00000001FF

I want to separate the hex file is as below

020000040000FA
20800000 61FC000000000000000000000000000000000000000000000000000000000000 03
20802000 0000000000000000000000000000000000000000000000000000000000000000 40
20804000 0000000000000000000000000000000061FC0000000000000000000000000000 C3
20806000 0000000000000000000000000000000000000000000000000000000000000000 00
040000050000940063
00000001FF

How can I do this in Python? I have something like this:

path = "C:\\Users\\sys_val_lab\\Desktop\\Py_Canoe\\Text_File.txt"
import bincopy
f = bincopy.BinFile(path)
print(f.as_ihex())
toyota Supra
  • 3,181
  • 4
  • 15
  • 19

0 Answers0