DEV Community

SHAMEEM ALI
SHAMEEM ALI

Posted on

Usage of "With" in python

In python the "with" keyword is used when working with unmanaged resources (like file streams). It is similar to the using statement in VB.NET and C#. It allows you to ensure that a resource is "cleaned up" when the code that uses it finishes running, even if exceptions are thrown.

Discussion (0)