Python‎ > ‎list‎ > ‎

list.index()

http://www.adilwaseem.com/

Definition
Return first index of value.

Syntax
L.index(value, [start, [stop]]) -> integer

Parameters
Value
Start=integer

Examples
The value as return as:
 >>> x=[1,3,4,5,6]
>>> x.index(3)
1
>>> x
[1, 3, 4, 5, 6]
>>> x.index(4)
2
>>> x.index(6)
4
>>> 
>>> list1
['Python', 'Lake', 'Research']
>>> list1.index("Research")
2
>>> list1.index("Python")
0
>>> 

Comments