← All posts
postMay 10, 2026
Python lists — the workhorse of data work
#python#lists#basics
python
rows = ["alice", "bob", "carol"]
print(rows[0]) # alice
print(len(rows)) # 3
rows.append("dave") # add at end
rows.remove("bob") # remove by value
for name in rows:
print(name)A list is an ordered collection of values. You create one with square brackets and access elements by their index, starting at zero. Lists can hold any type — numbers, strings, even other lists.
In data engineering, lists are everywhere. You read a CSV and get a list of rows. You query a database and get a list of records. You collect file paths from a directory into a list. Knowing how to add, remove, and iterate items is non-negotiable.