Loïc G.
Loïc G.

Reputation: 3157

Convert Intel HEX file to binary file

I have a Intel HEX file and I want to have a binary file. How, in python ?

I think use the binascii module but I don't know what function is the most appropriate. Thanks

Upvotes: 6

Views: 9149

Answers (2)

luc
luc

Reputation: 43146

You may be interested in the IntelHex python lib.

Upvotes: 8

yan
yan

Reputation: 20992

If you have a string of hex, you can decode it using the decode method. For instance,

>>> s = '0001020304'
>>> s.decode('hex')
'\x00\x01\x02\x03'

Upvotes: -1

Related Questions