Mega Code Archive

 
Categories / Python Tutorial / List
 

The index method is used for searching lists to find the index of the first occurrence of a value

knights = ['We', 'are', 'the', 'knights', 'who', 'say', 'ni'] print knights.index('who')