Python 3 reference · 2 entries

Python Tuple Methods

Tuples are immutable, so they have just two methods, count() and index(). Both are explained here with examples.

NameDescriptionSince
tuple.count() Return how many times a value appears in the tuple, comparing each item with ==. Returns 0 if it never appears. 3.0
tuple.index() Return the position of the first item equal to a value. Raises ValueError if it isn't in the tuple. 3.0