On Tue, 11 Mar 2025, RAGINI wrote:


 The latter is a 'compound' statement!

 the 'with' statement allows the execution of
 - initialization code
 - finalization code
 around a block of code

 In the example above, when you open() a file you also need to close() the
 file.
I see.

Out of the two which one would you recommend that as a community we
should use?

and Why?


To understand it better, there is a PEP-343
https://peps.python.org/pep-0343/


warm regards
Saifi.

Reply via email to