【问题标题】:precision in python forpython中的精度
【发布时间】:2015-09-13 12:03:21
【问题描述】:

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

 2.250000e-6

有人可以帮忙吗?

【问题讨论】:

标签: python


【解决方案1】:
'{:.6e}'.format(f) # format f exponentially using a base of 6 decimal places

【讨论】:

    【解决方案2】:

    使用科学格式

    print("%e.6" %f)
    

    【讨论】:

      【解决方案3】:

      使用

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

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

      【讨论】:

        猜你喜欢
        • 2014-02-08
        • 2023-03-09
        • 1970-01-01
        • 2016-04-30
        • 2010-12-28
        • 2013-07-06
        • 1970-01-01
        相关资源
        最近更新 更多