Python Basics
Python Advanced
Python Useful References
Python Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM
|
Python List index() Method
Description:
This method returns the lowest index in list that obj appears
Syntax:
Parameters:
Here is the detail of parameters:
Return Value:
It returns index of the found object otherwise raise an exception indicating that value does not find.
Example:
#!/usr/bin/python
aList = [123, 'xyz', 'zara', 'abc'];
print "Index for xyz : ", aList.index( 'xyz' ) ;
print "Index for xxx : ", aList.index( 'zara' ) ;
|
This will produce following result:
Index for xyz : 1
Index for xxx : 2
|
|
|
|