Find index of item in list

wes weston wweston at att.net
Tue Dec 7 20:19:31 CET 2004


Sean Berry wrote:
> Given
> 
> myList = ['cat', 'dog', 'mouse' ... 'bear']
> 
> what is the easiest way to find out what index 'dog' is at?
> 
> 
> 
Sean,

 >>> myList = ['cat', 'dog', 'mouse','bear']
 >>> myList.index('dog')
1
 >>>

wes




More information about the Python-list mailing list