Dmitry Dzhus skrev:
>> Actually I'm trying to convert a string to a list of float numbers:
>> str = '53,20,4,2' to L = [53.0, 20.0, 4.0, 2.0]
> 
> str="53,20,4,2"
> map(lambda s: float(s), str.split(','))
> 
> Last expression returns: [53.0, 20.0, 4.0, 2.0]

The lambda is not needed there, as float is a callable.

map(float, str.split(','))

-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to