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 >>> 2011/3/25 Blockheads Oi Oi <breamore...@yahoo.co.uk> > On 25/03/2011 15:27, Jason Swails wrote: > >> I'm guessing you have something like >> >> list1=['1.0', '2.3', '4.4', '5.5', ...], right? >> >> You can do this: >> >> for i in range(len(list1)): >> list1[i] = float(list1[i]) >> >> > or > > for i, x in enumerate(list1): > list1[i] = float(x) > > > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list