Lists and dictionaries
The methods of lists and dictionaries, as in Python.
Lists
list.append(x)method
Adds x at the end.
list.extend(items)method
Adds all the elements of items at the end.
list.insert(i, x)method
Inserts x at position i.
list.pop(i=-1)method
Removes and returns the element at position i, the last one if missing.
list.remove(x)method
Removes the first element equal to x.
list.index(x)method
The position of the first element equal to x.
list.count(x)method
How many elements are equal to x.
list.reverse()method
Reverses the list.
list.sort(key=None, reverse=False)method
Sorts the list; key is the function that gives the value to compare.
list.copy()method
A copy of the list.
list.clear()method
Removes all the elements.
Dictionaries
dict.get(key, default=None)method
The value of key, or default if it isn’t there.
dict.items()method
The (key, value) pairs, in insertion order.
dict.keys()method
The keys, in insertion order.
dict.values()method
The values, in insertion order.
dict.pop(key, default)method
Removes key and returns its value, or default if it isn’t there.
dict.copy()method
A copy of the dictionary.
dict.clear()method
Removes all the entries.