os.path.join (folder, filename) ensures the path is correct for the system. On Windows, it uses backslashes (reports\summary.txt); on Linux and macOS it uses forward slashes (reports/summary.txt).
One of the features that makes Python a great programming language is exceptions for error handling. Exceptions are convenient in many ways for handling errors and ...