reading-notes

Code Fellows courses Notes

This project is maintained by QamarAlkhatib

FileIO & Exceptions

Reading and Writing Files in Python (Guide)

reading a file in python is quite simple since there is a built-in methods for this purpose, and the methods are as follows:


Now let’s dive into writing files. As with reading files, file objects have multiple methods that are useful for writing to a file:


Python Exceptions

An exception is an event that occurs during the execution of a Python program. It can happen even though the program is already running. This type of error occurs whenever syntactically correct Python code results in an error.

here is an example of built-in exceptions in python: