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).
If you use Excel 40 hours a week (and those are the weeks you are on vacation), welcome to the MrExcel channel. Home to 2,400 free Excel tutorials. Bill "MrExcel" Jelen is the author of 67 books about ...