我有一個拉弦了一個文本文件的一些Python代碼:Python的錯誤:無法將字符串轉換爲浮動
[2.467188005806714e-05, 0.18664554919828535, 0.5026880460053854, ....]
Python代碼:
v = string[string.index('['):].split(',')
for elem in v:
new_list.append(float(elem))
這給出了一個錯誤:
ValueError: could not convert string to float: [2.974717463860223e-06
爲什麼[2.974717463860223e-06
不能轉換爲浮點數?
你看到'['你的錯誤信息? – 2012-04-16 14:53:40