38

I have a number that prints out in exponential form:

>>>
>>> a = 1/1221759
>>> print(a)
8.184920266599223e-07
>>>

How can i make it print in normal form?

Jean-François Corbett
  • 36,032
  • 27
  • 135
  • 183
kafedakias
  • 457
  • 1
  • 6
  • 10

2 Answers2

61

You can format it as a fixed-point number.

>>> a = 1/1221759
>>> '{0:.10f}'.format(a)
'0.0000008185'
Jeff Mercado
  • 121,762
  • 30
  • 236
  • 257
9

You can use print formatting:

print "%.16f" % a

where 16 is the number of digits you want after the decimal point.

Jimtronic
  • 1,169
  • 1
  • 8
  • 21