On Mar 25, 9:19 pm, "bruno.desthuilli...@gmail.com" <bruno.desthuilli...@gmail.com> wrote: > On 25 mar, 16:19, joy99 <subhakolkata1...@gmail.com> wrote: > > > > > Dear Group, > > > I got a question which might be possible but I am not getting how to > > do it. > > > If I have a list, named, > > list1=[1.0,2.3,4.4,5.5....] > > > Now each element in the array holds the string property if I want to > > convert them to float, how would I do it? > > > Extracting the values with for and appending to a blank list it would > > not solve the problem. If appended to a blank list, it would not > > change the property. > > > If any one of the learned members can kindly suggest any solution? > > >>> print source > > ['0.0', '1.0', '2.0', '3.0', '4.0', '5.0', '6.0', '7.0', '8.0', '9.0']>>> > source[:] = map(float, source) > >>> print source > > [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0] > > > > Note the "source[:] = " part - it modifies the list in place.
Thanks Bruno. I just missed it. I got it back and thanks Blockhead for giving me new angle to look into the problem. Best Regards, Subhabrata. -- http://mail.python.org/mailman/listinfo/python-list