【Python】How do I convert a string to a double in Python?
Date: 2018.5.30
Reference:
https://stackoverflow.com/questions/482410/how-do-i-convert-a-string-to-a-double-in-python
Method1:
pi = ‘3.1415926’
float(pi)
3.1415926
Method2:
from decimal import Decimal
x = “234243.434”
print Decimal(x)
234243.434
本文为博主原创文章,未经博主允许不得转载。若允许转载,请注明来源https://www.cnblogs.com/SoaringLee/,否则保留追究法律责任的权利!
另外,本人提供付费咨询服务并长期承接各类毕设以及外包项目。联系QQ:2963033731。加Q备注:CNBLOG外包