Python equivalent to the "A" or "a" output conversions in C

Edward C. Jones edcjones at comcast.net
Tue Jun 19 15:54:05 EDT 2012


On 06/19/2012 12:41 PM, Hemanth H.M wrote:

> >>> float.hex(x)
> '0x1.5000000000000p+3'
>
Some days I don't ask the brightest questions.  Suppose x was a numpy 
floating scalar (types numpy.float16, numpy.float32, numpy.float64, or 
numpy.float128).  Is there an easy way to write x in
binary or hex?






More information about the Python-list mailing list