Q: How do I read the result of a python struct? Can somebody please tell me how do I read the result b'\x9a\x99\x99?' of
import struct
data = struct.pack("@f", 1.2)
print(data)

What does \x9a represent? Or \x99? How do I translate this back to 1.2?

A: The data is stored in a binary format. To get the value back, use struct.unpack:
import struct
data = struct.pack("@f",1.2)
print(struct.unpack("@f",data))

Related: Why won't Python display this text correctly? (UTF-8 Decoding Issue)
