Close
Close window
index - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

index

find index of element within list

Calling Sequence

x.index(y)

Parameters

x

-

List object

y

-

Expression or Python expression

Description

The index function returns the index of y within the List x. If y does not appear in x, a ValueError is raised.

Note that as x is a Maple list, the index of the first element is 1.

Examples

The following interactive session illustrates the use of index:

>>> import maplesoft.maple as mpl

>>> import maplesoft.maple.namespace as msymbol

>>> S1 = mpl.execute('[ a, b, c, 2, 3, 4 ]:')

>>> S1.index( msymbol.b )

2

>>> S1.index( 3 )

5

>>> S1.index( msymbol.x )

ValueError: is not in list


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /