Newbie question on tuples

djw dwelch91.nospam at comcast.net
Thu Feb 5 21:05:52 EST 2004


Jonathan Daugherty wrote:

> # Tuples don't have an index method, but lists do, so you can list-ify your
> # tuple:
> 
> They most certainly do.
> 
> --
> 
>   Jonathan Daugherty
>   http://www.cprogrammer.org
> 
>   "It's a book about a Spanish guy called Manual, you should read it."
>                                                             -- Dilbert
> 

Huh?

 >>> ("rock", "scissors", "paper").index("rock")
Traceback (most recent call last):
   File "<interactive input>", line 1, in ?
AttributeError: 'tuple' object has no attribute 'index'
 >>>

-D




More information about the Python-list mailing list