I have the following to format a string:
'%.2f' % n
If n
is a negative zero (-0
, -0.000
etc) the output will be -0.00
.
How do I make the output always 0.00
for both negative and positive zero values of n
?
(It is fairly straight forward to achieve this but I cannot find what I would call a succinct pythonic way. Ideally there is a string formatting option that I am not aware of.)