A.M skrev:

> I have a tuple like this:
>
> T = ("One","Two","Three","Four")
>
> Is there any built-in way to find what is the index of "Two" 
> withouot looping within the tuple?
>
> Is the same feature available for lists or dictionaries?

Lists have an index method:

#v+

>>> L = list(T)
>>> L.index('Three')
2
>>> 

#v-

Dictionaries are unordered and hence indices don't make much sense.

Mvh, 

-- 
Klaus Alexander Seistrup
SubZeroNet, Copenhagen, Denmark
http://magnetic-ink.dk/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to