1

I want to convert -123.456 into a C double for network transmission in python. So I tried this:

struct.pack('d', -123.456)

I get this as a result:

'w\xbe\x9f\x1a/\xdd^\xc0'

Obviously there is some hex in there, but what is with the w, /, and ^ sprinkled in there?

Jake
  • 2,515
  • 5
  • 26
  • 41
  • If you want to see them in hex, try this: `struct.pack('d', -123.456).hex(" ")`: Out[37]: '77 be 9f 1a 2f dd 5e c0' – Youngmin Kim Jun 28 '23 at 00:46

1 Answers1

1

They are, respectively, a "w", "/", and "^". Some byte sequences do correspond to ASCII characters.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358