python代码块怎么把字符串转换为数字啊。。。

分享  收藏
10 / 321

input["shijiao"]得到的是这么个字符串:
["9000.00","12000.00","32000.00","10000.00","20000.00"]
转换为 float 型各种报错。。。

guimo1=["9000.00","12000.00","32000.00","10000.00","20000.00"]
nirr1=["0.65","22.74","12.81","0.00","11.46"]
guimo=input["shijiao"]
nirr=input["nirr"]

guimof = [ float(x) for x in guimo1]  //一旦替换为guimo,立即报错无法将str转换为float
nirrf = [ float(x) for x in nirr1 ]

s=sum(guimof)
outnirr=0
for i in range(len(guimof)):
  outnirr += (guimof[i]/s)*nirrf[i]
output = {'加权平均nirr':outnirr,'shijiao':guimo}