for v in l:

Nanjundi nanjundi at gmail.com
Mon Jan 15 20:09:12 EST 2007


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
> 
>         for v in l:
>                 l[v]=l[v]+x




More information about the Python-list mailing list