Python equivalent to the "A" or "a" output conversions in C
Alexander Blinne
news at blinne.net
Tue Jun 19 13:00:26 EDT 2012
On 19.06.2012 18:23, Edward C. Jones wrote:
> Consider the following line in C:
> printf('%a\n', x);
> where x is a float or double. This outputs a hexadecimal representation
> of x. Can I do this in Python?
Don't know why there is no format character %a or %A in python, but the
conversion is done by float method hex():
a = 3.1415
print a.hex()
Greetings
More information about the Python-list
mailing list