1

I want to print the number 1e-3 instead of 0.001 in python. Do we have any option in print function to print it?

number=0.001 print ('This is 0.6f ', number)

Jame
  • 3,746
  • 6
  • 52
  • 101
  • 2
    Possible duplicate of [Display a decimal in scientific notation](https://stackoverflow.com/questions/6913532/display-a-decimal-in-scientific-notation) – Shintlor Sep 06 '18 at 08:25

1 Answers1

2

Not exactly from the print function, but you can achieve this with:

import decimal
number = '0.001'
print ('%.3E' % decimal.Decimal(number))
Rene Trujillo
  • 379
  • 3
  • 16