ok thx this was just what i was looking for
http://docs.python.org/tut/node7.html#SECTION00760
--
http://mail.python.org/mailman/listinfo/python-list
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
>
> something like
>
> for v in l:
> l[v]=l[v]+
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
Try:
l = [i+x for i in l]
OR
l = map(lambda i: i+x, l)
-N
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
>
> something like
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
something like
for v in l:
l[v]=l[v]+x
--
http://mail.python.org/mailman/listinfo/python-list