literal hex value to bin file.

Peter L Hansen peter at engcorp.com
Thu Oct 7 06:56:28 EDT 2004


yaipa h. wrote:
> Sorry if this has been asked before, doing a search on c.l.p, I didn't
> find this particular use case.
> 
> I wish to use the struct module, in windows, to pack hexdigits in such
> a way that when I pack, say 0xa into a packed object, I can then use
> it to find 0xa in a binary file.

The question is unclear to me, but wouldn't just using "\x0a"
build a string (i.e. a 'byte sequence') with identical contents?
A "packed object" from struct is merely a string.

> Likewise, I wish to build a hex sequence from an Assembly language
> .lst (text)file so that I can search for that sequence of hex digits
> in a binary file.

Unclear.  Please provide examples of before and after cases
of each thing mentioned above to help guide us...

-Peter



More information about the Python-list mailing list