python:科学计数法转化为浮点型数据

1 def as_num(x):
2     y='{:.5f}'.format(x) # 5f表示保留5位小数点的float型
3     return(y)

实验一下

1 as_num(1.2e-4)
1 In [3]:as_num(1.2e-4)
2 Out[3]: '0.00012'
原文地址:https://www.cnblogs.com/hahaxzy9500/p/6854027.html