I am looking to convert some small numbers to a simple, readable output. Here is my method but I wondering if there is something simpler.
x = 8.54768039530728989343156856E-58
y = str(x)
print "{0}.e{1}".format(y.split(".")[0], y.split("e")[1])
8.e-58
This gets you pretty close, do you need
8.e-58exactly or are you just trying to shorten it into something readable?An alternative:
Note that on Python 2.7 or 3.1+, you can omit the first zero which indicates the position, so it would be something like
"{:.1e}".format(x)