Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

convert a string in float but not a list of string in list of float

This is a very weird behaviour.

Suppose I have a list such

A=['1.2', '2.565', '3.45']

If I I create the command A[1]=float(A[1]) the result is

A=[1.2, '2.565', '3.45']

Now if I ask

for i in range(len(A)):

the result is ValueError: could not convert string to float:

Do I do something forbiden ?