Jens grønborg Jens grønborg - 25 days ago 7
Python Question

How to remove ' ' in a python list

I load a csv.file where the dataset comes in the form ('5.5','4.3'...)

How can I remove the ' '?

I've tried with replace, but it doesn't seem to work with the '.

Thanks!

It's basically:

['1'] => [1]

Answer

As you are working with float data type, the following list builder code (as previously pointed in the comments) should work.

row = [float(i) for i in row]