ValueError: could not convert string to float: '.'
问题 I have a list of strings (CD_cent) like this: 2.374 2.559 1.204 and I want to multiply these numbers with a float number. For this I try to convert the list of strings to a list of floats for example with: CD_cent2=[float(x) for x in CD_cent] But I always get the error: ValueError: could not convert string to float: '.' . I guess this means, that it can't convert the dot to a float (?!) But how could I fix this? Why doesn't it recognize the dot? 回答1: You need to split each string as the