Catching Errors in file handling
Errors are inevitable. How to catch errors in python while reading or writing files
We'll cover the following
Sometimes when you are working with files, bad things happen. The file is locked because some other process is using it or you have some kind of permission error. When this happens, an IOError will probably occur. In this section, we will look at how to catch errors the normal way and how to catch them using the with operator. Hint: the idea is basically the same in both!
Get hands-on with 1400+ tech skills courses.