Learn collections
Specialised containers: Counter, defaultdict, deque, namedtuple and more
The collections module adds high-performance container types to Python's built-in list, dict, set and tuple: Counter for tallies, defaultdict for grouping, deque for queues, namedtuple for lightweight records, OrderedDict and ChainMap for ordering and layering. Its companion collections.abc defines the abstract interfaces of all containers. Using the right container makes code shorter and often much faster.
Before you start
How deep do you want to go?
1. EssentialsRead and write simple code, do the everyday basics
2. PracticalUse it productively at work, with the usual idioms
3. AdvancedThe less common features, performance and trade-offs
4. ExpertInternals and the edge cases experts know