The following methods are common to most sequence types, such as lists, tuples, sets, and strings, except where indicated:
- x in seq: True if an item within the sequence is equal to x; otherwise, False is returned. This also applies to a subset of a sequence, such as looking for a specific character within a string.
- x not in seq: True if no item within the sequence is equal to x; otherwise, False is returned.
- seq1 + seq2: Concatenates two sequences; if immutable sequences, a new object is created.
- seq * n: Adds a sequence to itself n times.
- seq[i]: Returns the
item of a sequence, with the first object's index value = 0.
- seq[i:j] ...