I have a python list (`vals`) containing lists of strings like this:

```
[['540.0 ', '0.0 ', '0.0 ', '162.0 ', '2.5 ', '1040.0 ', '676.0 ', '28 ', '79.99 \r'], 

['540.0 ', '0.0 ', '0.0 ', '162.0 ', '2.5 ', '1055.0 ', '676.0 ', '28 ', '61.89 \r'], ...]

```

When I want to convert its elements with the code below, I get the following error:

`ValueError: could not convert string to float`

```
vals = [[float(item) for item in rec] for rec in vals]

```

How can I solve this problem?