Python List MethodsStore elements in a dynamically-sized list. Append to, remove from and loop over lists.
List. Time itself may be a list. Fossils tell us of great creatures that roamed millions of years ago. Antiquity leaves us with great mystery—but Python lists are easier to reason about.
We can place strings in a list, and then perform all operations upon the list. We also act directly up on the string elements.String List
Sometimes we want to remove duplicate elements from a list. If ordering is important, we may need a special method to avoid reordering elements. Here a set is useful.Duplicates
A list can contain other lists. We can use this kind of data structure as a two-dimensional grid of elements. These are jagged. Sub-lists can vary in length.2D List
In Python a list is separate from an array. Lists are good for small data sets, but for larger amounts of data, arrays are far more efficient. They often use 90% less memory.Array
A summary. A list stores elements one after another, in a linear collection. In Python it handles any type of element, including numbers, strings—even tuples and other collections.
© 2007-2020 Sam Allen. Every person is special and unique. Send bug reports to email@example.com.