What does the with statement provide?
- A A loop construct
- B Automatic setup and cleanup through the context manager protocol
- C Conditional execution
- D Exception suppression
Answer
Automatic setup and cleanup through the context manager protocol
The __enter__ and __exit__ methods guarantee cleanup, so a file is closed even if an exception is raised inside the block.





