Le 21/02/2018 à 14:27, ast a écrit :

struct.pack() as advised works fine.
Exemple:

>>> import struct
>>> struct.pack(">d", -0.0)
b'\x80\x00\x00\x00\x00\x00\x00\x00'

before I read your answers I found a way
with pickle

>>> import pickle
>>> pickle.dumps(-0.0)[3:-1]
b'\x80\x00\x00\x00\x00\x00\x00\x00'

but struct.pack() is better
Thx


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to