November 2018
Beginner
304 pages
7h 35m
English
Note that in the list of file operations in the File I/O section, the standard read modes produce an input/output (I/O) error if the file doesn't exist. If you end up with this error, your program will halt and give you an error message, like in the following screenshot:

To fix this, you should always open files in such a way as to catch the error before the program crashes. When you are performing an operation where there is a potential for an exception to occur, you should wrap that operation within a try/except code block. This will attempt to run the operation; if an exception is thrown, you can catch it ...
Read now
Unlock full access