Python List - Index Method

Find the index of the nth occurence of an element in the python list object with the index method

List Updated 15 Sep 2016 1 min read

Method Name: index(value_in,occurence_in=1)

Method Overview

The index method returns the index of the nth occurence of the value_in element.

Parameters

value_in - value for which the index to be found in the python list
occurence_in - occurence count for which the index to be found for the specified element in the python list

Exceptions

A ValueError will be raised if the specified value is not found.

python
>>> GalileanMoons=["Io", "Europa", "Ganymede", "Callisto"]

>>> GalileanMoons.index("Callisto")

3