Message143454
I agree with you on the correct 8 output bytes. And those expected bytes are exactly what struct.pack is producing here:
Python 2.7.2 |EPD 7.1-1 (32-bit)| (default, Jul 3 2011, 15:40:35)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "packages", "demo" or "enthought" for more information.
>>> import struct
>>> struct.pack('!d', 1.2345)
'?\xf3\xc0\x83\x12n\x97\x8d'
>>> len(struct.pack('!d', 1.2345))
8
>>> struct.pack('!d', 1.2345).encode('hex')
'3ff3c083126e978d'
I suspect that the confusion arises from the way the output string is displayed: the 8 bytes in the output string are escaped if they're not printable ASCII characters, and are displayed directly otherwise (notice the '?' and the 'n', with codes 0x3f and 0x63 respectively). |
|
Date |
User |
Action |
Args |
2011-09-03 07:22:46 | mark.dickinson | set | recipients:
+ mark.dickinson, SchorschMCMLX |
2011-09-03 07:22:45 | mark.dickinson | set | messageid: <1315034565.89.0.757336924861.issue12889@psf.upfronthosting.co.za> |
2011-09-03 07:22:45 | mark.dickinson | link | issue12889 messages |
2011-09-03 07:22:44 | mark.dickinson | create | |
|