[Tutor] Accessing List items
Max Noel
maxnoel_fr at yahoo.fr
Mon Mar 21 13:13:56 CET 2005
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 at you hacker... A pathetic creature of meat and bone, panting
and sweating as you run through my corridors... How can you challenge a
perfect, immortal machine?"
--
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting
and sweating as you run through my corridors... How can you challenge a
perfect, immortal machine?"
More information about the Tutor
mailing list