[BangPypers] packing floating data

Noufal Ibrahim noufal at gmail.com
Mon May 31 14:14:14 CEST 2010


On Mon, May 31, 2010 at 5:34 PM, murugadoss <murugadoss2884 at gmail.com> wrote:
> 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))

http://docs.python.org/library/struct.html#format-characters





-- 
~noufal
http://nibrahim.net.in


More information about the BangPypers mailing list