Re: [Tutor] Accessing List items

2005-03-21 Thread Bill Mill
On Mon, 21 Mar 2005 11:57:21 +, Matt Williams <[EMAIL PROTECTED]> wrote: > Dear List, > > Thanks for the help with the previous problem - now all solved! > > I have a question about accessing lists. I'm trying to do something to > each item in a list, and then assign it back into the list, ov

Re: [Tutor] Accessing List items

2005-03-21 Thread Max Noel
On Mar 21, 2005, at 12:57, Matt Williams wrote: for i in range(len(y)): y[i]="z" print y Surely there must be a better way than this ? Sounds like a job for... list comprehensions! (cue cheesy superhero music) y = ["z" for i in y] -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look

[Tutor] Accessing List items

2005-03-21 Thread Matt Williams
Dear List, Thanks for the help with the previous problem - now all solved! I have a question about accessing lists. I'm trying to do something to each item in a list, and then assign it back into the list, overwriting the old value. However, the first loop here doesn't work, whereas the second lo