【发布时间】:2015-09-13 12:03:21
【问题描述】:
我有数字 f = 2.25e-06,我想以格式打印它
2.250000e-6
有人可以帮忙吗?
【问题讨论】:
-
str.format 具体请参考python手册Format String Syntax
标签: python
我有数字 f = 2.25e-06,我想以格式打印它
2.250000e-6
有人可以帮忙吗?
【问题讨论】:
标签: python
'{:.6e}'.format(f) # format f exponentially using a base of 6 decimal places
【讨论】:
使用科学格式
print("%e.6" %f)
【讨论】:
使用
print format(a[0]/a[1], '.8f)
'8f' 是您想要的小数位数。
【讨论】: