Tuple question

Wai Yip Tung tungwaiyip at yahoo.com
Thu Sep 2 12:37:03 EDT 2004


I'm not sure what do you mean by index. But you can use len() to get the  
number of objects in a tuple. e.g.

>>> t=(1,2,3)
>>> len(t)
3
>>> t[2]
3
>>>

> Hi,
>
> Why is that a tuple doesnt have the methods 'count' and 'index'? It  
> seems they could be present on a immutable object.
>
> I realise its easy enough to convert the tuple to a list and do this,  
> I'm just curious why it is neccesary..
>
>
> Thanks,
>
> Will McGugan




More information about the Python-list mailing list