python中的精度

时间:2015-06-26 13:42:10

标签: python

我的数字f = 2.25e-06,我想以格式打印

 2.250000e-6
有人可以帮忙吗?

3 个答案:

答案 0 :(得分:0)

'{:.6e}'.format(f) # format f exponentially using a base of 6 decimal places

答案 1 :(得分:0)

使用科学格式

print("%e.6" %f)

答案 2 :(得分:0)

使用

print format(a[0]/a[1], '.8f)

'8f'是您想要的小数位数。