Basic question

Dmitry Dzhus mail at sphinx.net.ru
Sat May 12 14:40:47 EDT 2007


> 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]
-- 
Happy Hacking.

Dmitry "Sphinx" Dzhus
http://sphinx.net.ru



More information about the Python-list mailing list