0

Hello,

How can I control the representation of my exponential number?

4.840000E+02 need to define how many numbers I want after the point?

Is there a way to define it when I create it from integer?

Thank you very much

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Axelro
1

'e' Floating point exponential format (lowercase). (3)
'E' Floating point exponential format (uppercase). (3)


The alternate form causes the result to always contain a decimal point, even if no digits follow it.

The precision determines the number of digits after the decimal point and defaults to 6.

Straight from documents you know so well (http://docs.python.org/library/stdtypes.html#string-formatting). Here test:

>>> number= 4.840000E+02
>>> print number
484.0
>>> print "%e" % number
4.840000e+02
>>> print "%.3E" % number
4.840E+02
>>> print "%.3e" % number
4.840e+02
>>>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.