for v in l:
Gabriel Genellina
gagsl-py at yahoo.com.ar
Mon Jan 15 20:38:49 EST 2007
At Monday 15/1/2007 21:48, Gert Cuykens wrote:
>is there a other way then this to loop trough a list and change the values
>
> i=-1
> for v in l:
> i=i+1
> l[i]=v+x
for i,value in enumerate(my_list):
my_list[i] = compute_new_value(value)
See the tutorial
http://docs.python.org/tut/node7.html#SECTION007600000000000000000
for more info about loops.
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
More information about the Python-list
mailing list