getting rid of leading zeros in float expotential

Stebanoid at gmail.com Stebanoid at gmail.com
Sun Jun 3 18:42:26 CEST 2007


On 3    , 11:47, t... at finland.com wrote:
> Hi! I'm wondering whether there's an easy way to remove unnecessary
> leading zeros from my floating point number.
>
> realS = float(-1.25e-5)
> imgS = float(-7.6e4)
>
> print complex(realS, imgS)
>
>  >> (-1.25e-005-76000j)
>
> I would like it to look like (-1.25e-5-76000j)

why?
For printing?
try to process it as a string

>>>def my_func(a):
               return my_del_zeros_func(str(a))




More information about the Python-list mailing list