newbie idiom question

Klaus Alexander Seistrup kas at maps.magnetic-ink.dk
Tue Jun 22 03:58:55 EDT 1999


Alex Rice wrote:

> I keep trying to do this:
> 
>       >>> eggs = [1,2,3]
>       >>> for spam in eggs:
>       ...       spam = 'cooked'
>       ...
>       >>> eggs
>       [1, 2, 3]
>       >>>
 
How about:

  >>> eggs = [1,2,3]
  >>> for i in range (len (eggs)):
  ...     eggs[i] = 'cooked'
  ... 
  >>> eggs
  ['cooked', 'cooked', 'cooked']
  >>>

?

  //Klaus

-- 
···[ Magnetic Ink ]·························································
···[ http://www.magnetic-ink.dk/ ]··········································




More information about the Python-list mailing list