Part 2 · Section 11

Project 5

This project brings the section on context managers together with iterators, generators and named tuples. Given nothing but a file name, you’ll build a context manager that opens a CSV file, works out its format on its own, and hands you a lazy stream of named tuples whose fields come from the header row. Then you’ll rebuild the same tool as a generator function with contextlib.contextmanager, and compare the two designs.

In this project you’ll:

Lectures

  1. 01Description✓
  2. 02Solution - Goal 1✓
  3. 03Solution - Goal 2✓

Practice: quiz & exercises

7 quiz questions · 3 coding exercises

Go to practice →