Why You Should Use Context Managers in Python
Published in
5 min readNov 13, 2021
What is a Context Manager
If you have used the with
statement in Python then chances are you’ve already used a context manager.
A context manager usually takes care of setting up some resource, e.g. opening a connection, and automatically handles the clean up when we are done with it.