Python3 Att List Index
# Python3.x Python3 List index() Method
[ Python3 Lists](#)
* * *
## Description
The `index()` method is used to find the index position of the first matching item in a list.
## Syntax
The syntax for the `index()` method is:
list.index(x[, start[, end]])
## Parameters
* x -- The object to search for.
* start -- Optional. The starting position for the search.
* end -- Optional. The ending position for the search.
## Return Value
This method returns the index position of the searched object. If the object is not found, it raises an exception.
## Example
The following examples demonstrate the usage of the `index()` method:
## Example 1
#!/usr/bin/python3
list1 =['Google','Tutorial','Taobao']
print('Tutorial index is', list1.index('Tutorial'))
print('Taobao index is', list1.index('Taobao'))
The output of the above example is:
Tutorial index is 1Taobao index is 2
## Example 2
#!/usr/bin/python3
list1 =['Google','Tutorial','Taobao','Facebook','QQ']
# Search starting from a specified position
print('Tutorial index is', list1.index('Tutorial',1))
The output of the above example is:
Tutorial index is 1
[ Python3 Lists](#)
YouTip