Using with to automatically close resources | More Python for Beginners [16 of 20]

When working with external resources, such as files, it's important to close the handle as soon as you're done using the resource. Unfortunately, it can be pretty easy to forget to properly close off the handle when you're done using it. Fortunately, Python includes a cool keyword called with to help manage external resources.

Watch the Python for Beginner series here: https://aka.ms/PythonBeginnerSeries
For the Full 'Intro to Python' course on Microsoft Learn: https://aka.ms/MSLearnPython
All video content will available at: https://github.com/microsoft/c9-python-getting-started/
First series: https://github.com/microsoft/c9-python-getting-started/tree/master/python-for-beginners
Second series: https://github.com/microsoft/c9-python-getting-started/tree/master/more-python-for-beginners
Third series: https://github.com/microsoft/c9-python-getting-started/tree/master/even-more-python-for-beginners-data-tools

#microsoftdeveloper #morepythonforbeginners #learntocode