Reputation: 19
I am using python to convert a long to little endian:
import struct
test = "0xbfffef40";
print(struct.pack('<L', long(test, 16)))
which displays as
@???
But I am having issues working out a nice way to print it in the form:
\x40\xef\xff\xbf
As a string to the terminal (just for logging).
Upvotes: 1
Views: 87
Reputation: 547
You can try this code with little improvements
import struct
test = "0xbfffef40"
print(struct.pack('<L',int(test, base=16)))
Upvotes: 1