getting rid of leading zeros in float expotential

T

tom

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)

I would like it to look like (-1.25e-5-76000j)
 
S

Stebanoid

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)


I would like it to look like (-1.25e-5-76000j)

why?
For printing?
try to process it as a string
return my_del_zeros_func(str(a))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top