【发布时间】:2019-11-02 19:48:19
【问题描述】:
我创建了等于 ['jan', 'feb', 'mar', '451'] 的 y 列表 我试图将 y[3] 的类型转换为浮点数,但是当我打印 y[3] 的类型时,它似乎是一个字符串。
有什么问题?
>>>x = "jan feb mar 451"
...y = x.split()
...float(y[3])
...type(y[3])
str
【问题讨论】:
标签: python-3.x string type-conversion