将科学记数法转换为小数 [英] Convert scientific notation to decimals

查看:75
本文介绍了将科学记数法转换为小数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的文件中有数字(所以,作为字符串)以科学记数法表示,例如:

I have numbers in a file (so, as strings) in scientific notation, like:

8.99284722486562e-02 

但我想将它们转换为:

0.08992847

是否有任何内置函数或任何其他方法可以做到这一点?

Is there any built-in function or any other way to do it?

推荐答案

我很确定你可以做到:

float("8.99284722486562e-02")
# and now with 'rounding'
"{:.8f}".format(float("8.99284722486562e-02"))

这篇关于将科学记数法转换为小数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆