Re: convert floats to their 4 byte representation

2006-06-14 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, godavemon <[EMAIL PROTECTED]> wrote: >I've been a member for a while but I had no idea how helpful this form >is. I had a one hour meeting and when I came back there were 4 >replies. Thanks for your help! > > >Scott David Daniels wrote: >> godavemon wrote: >> > I n

Re: convert floats to their 4 byte representation

2006-06-14 Thread godavemon
I've been a member for a while but I had no idea how helpful this form is. I had a one hour meeting and when I came back there were 4 replies. Thanks for your help! Scott David Daniels wrote: > godavemon wrote: > > I need to take floats and dump out their 4 byte hex representation. > > This is

Re: convert floats to their 4 byte representation

2006-06-14 Thread Scott David Daniels
godavemon wrote: > I need to take floats and dump out their 4 byte hex representation. > This is easy with ints with the built in hex function or even better > for my purpose > > def hex( number, size ): > s = "%"+str(size) + "X" > return (s % number).replace(' ', '0') This should be

Re: convert floats to their 4 byte representation

2006-06-14 Thread Grant Edwards
On 2006-06-14, godavemon <[EMAIL PROTECTED]> wrote: > I need to take floats and dump out their 4 byte hex representation. struct -- Grant Edwards grante Yow! Darling, my ELBOW at is FLYING over FRANKFURT,

Re: convert floats to their 4 byte representation

2006-06-14 Thread Tim Chase
> s = "%"+str(size) + "X" > return (s % number).replace(' ', '0') While I don't have a fast and easy way to represent floats, you may want to tweak this to be return ("%0*X" % (size,number)) which will zero-pad the number in hex to "size" number of places in a single step.

Re: convert floats to their 4 byte representation

2006-06-14 Thread Alex Martelli
godavemon <[EMAIL PROTECTED]> wrote: > I need to take floats and dump out their 4 byte hex representation. > This is easy with ints with the built in hex function or even better > for my purpose > > def hex( number, size ): > s = "%"+str(size) + "X" > return (s % number).replace(' ',

convert floats to their 4 byte representation

2006-06-14 Thread godavemon
I need to take floats and dump out their 4 byte hex representation. This is easy with ints with the built in hex function or even better for my purpose def hex( number, size ): s = "%"+str(size) + "X" return (s % number).replace(' ', '0') but I haven't been able to find anything f