Which Python code block is an example of using a context manager?
Python invokes context managers with a with statement. Its optional as clause binds the return value of __enter__() to a target, and __exit__() is invoked when execution leaves the block.
with
as
__enter__()
__exit__()
Community Discussion