This question asks how to suppress scientific notation in python.
I have a series of numbers to display -- small powers of 10 -- and I'd like to display them without trailing zeros. I.e. 0.1, 0.01, and so on to 0.000001
If I do "%s" % 10 ** -6
I get '1e-06'
. If I use "%f" % 10 ** -6
I get '0.000001'
which is what I want.
However, "%f" % 10 ** -3
yields '0.001000'
which violates the "without trailing zeros" constraint.
It's not hard to brute force a way around this (regex replacement or something), but I'm wondering if there's some format string magic I'm missing.