Python Programming - Exception Handling - Discussion
Discussion Forum : Exception Handling - General Questions (Q.No. 37)
37.
What is the purpose of the
with
statement in Python for file handling?
Answer: Option
Explanation:
The
with
statement is used for file handling in Python and ensures proper resource cleanup by automatically closing the file when the block is exited, even if an exception occurs.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers