Jens grønborg Jens grønborg - 1 year ago 96
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 '.


It's basically:

['1'] => [1]

Answer Source

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]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download