Larry Bates wrote:

Tuples don't have all the nice methods that lists have
so convert it to a list.

tuple=('a','b','c','d')
l=list(tuple)

now you can do:

list.index('c')

which returns 2

Remember index returns -1 when nothing is found.

No, that's .find in strings that returns -1. .index in lists raises a ValueError:


>>> [1, 2, 3].index(4)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: list.index(x): x not in list

--
Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
  The map is not the territory.
  -- Alfred Korzybski
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to