python中 str能转换成 float吗

2025-04-06 10:11:28
推荐回答(1个)
回答1:

当然,可以调用内置的float函数。如:
In [7]: a='1.2'
In [8]: b=float(a)
In [9]: b
Out[9]: 1.2