Here\'s my code:
x = 1.0
y = 100000.0
print x/y
My quotient displays as 1.00000e-05.
Is there any way to suppress
This will work for any exponent:
def getExpandedScientificNotation(flt):
str_vals = str(flt).split('e')
coef = float(str_vals[0])
exp = int(str_vals[1])
return_val = ''
if int(exp) > 0:
return_val += str(coef).replace('.', '')
return_val += ''.join(['0' for _ in range(0, abs(exp - len(str(coef).split('.')[1])))])
elif int(exp) < 0:
return_val += '0.'
return_val += ''.join(['0' for _ in range(0, abs(exp) - 1)])
return_val += str(coef).replace('.', '')
return return_val