这是我的代码我只需要将数字字符串转换为浮点数我有 aList= 列表列表
def convertData(aList):
for items in aList:
for x in items:
try:
float(x)
except ValueError:
pass
print (aList)
这就是我的清单
aList = [['Date', 'Assembly', 'Heat-treat', 'Painting', 'Inspection'], ['Monday', '0.352', '0.92', '0.182', '0.255'], ['Tuesday', '0.438', '0.809', '0.155', '0.225'], ['Wednesday', '0.323', '0.9', '0.169', '0.236'], ['Thursday', '0.383', '0.841', '0.172', '0.238'], ['Friday', '0.355', '0.352', '0.177', '0.227']]