Mark Dickinson <dicki...@gmail.com> added the comment: 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). ---------- nosy: +mark.dickinson resolution: -> invalid status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12889> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com