Description The method index() returns the lowest index in list that obj appears. Syntax Following is the syntax for index() method − list.index(obj) Parameters obj − This is the object to be find out. Return Value This method returns index of the found object otherwise raise an exception indicating that value does not find. Example: Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> testList = ['abc','foo','bar','woo','adc'] >>> print("Index of 'foo' is:%d"%testList.index('foo')) Index of 'foo' is:1 >>> print("Index for 'bar' is:%d"%testList.index('bar')) Index for 'bar' is:2 >>>
Just want to spend this life happier.