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)
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)
Not exactly from the print function, but you can achieve this with:
import decimal
number = '0.001'
print ('%.3E' % decimal.Decimal(number))