[BangPypers] packing floating data

murugadoss murugadoss2884 at gmail.com
Mon May 31 14:04:12 CEST 2010

Hi all,

I am trying to pack a float value like 45.90,43.78,543.87. i am using
struct.pack( ) function. When i unpack (using struct.unpack) and print it i
am getting only real part of the number.

Type of the variable is long,
var = 45.90
data = struct.pack("!l",float(var))

when i unpack and print, i am getting as 45,0,0,0. I am using byte type
while unpacking [struct.unpack("!B",data) ].

2. How to unpack short and long type data.

can anyone help me.
Thanks in advance

Thanks & Regards

More information about the BangPypers mailing list