Recipes: Python Data Structures¶
Short, task-focused how-tos for specific things you'll want to do with Python's built-in data structures. Each recipe assumes you already know the basics — if a term surprises you, the Learn section is one click away.
Unlike the tutorials, the recipes don't have a recommended order. Pick whichever is useful right now.
Recipes in this guide¶
- Sort and filter lists — sorting by custom criteria and filtering with comprehensions.
- Merge and compare dictionaries — combining dictionaries from multiple sources and finding differences.
- Work with nested structures — handling lists of dictionaries, dictionaries of lists, and deeply nested data.
- Convert between structures — transforming data between lists, tuples, dictionaries, and sets.
- Choose the right structure — a decision guide for picking the best data structure for a job.