Re: Basic question

2007-05-12 Thread Dmitry Dzhus

> 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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Basic question

2007-05-12 Thread Dmitry Dzhus

> "j=j+2" inside IF does not change the loop
> counter ("j")

You might be not truly catching the idea of Python `for` statements
sequence nature. It seems that 
will make things quite clear.

> The suite may assign to the variable(s) in the target list; this
> does not affect the next item assigned to it.

In C you do not specify all the values the "looping" variable will be
assigned to, unlike (in the simplest case) you do in Python.

-- 
Happy Hacking.

Dmitry "Sphinx" Dzhus
http://sphinx.net.ru
-- 
http://mail.python.org/mailman/listinfo/python-list