Converting an array of string to array of float

Blockheads Oi Oi breamoreboy at yahoo.co.uk
Fri Mar 25 12:17:43 EDT 2011


On 25/03/2011 15:46, Rafael Durán Castañeda wrote:
> But you must be sure that the list only contains objects than can be
> converted into float, if not you'll get:
>
>  >>> float('something')
> Traceback (most recent call last):
>    File "<pyshell#0>", line 1, in <module>
>      float('something')
> ValueError: could not convert string to float: something

You learn something new every day :)




More information about the Python-list mailing list