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).
Veronica Beagle is the managing editor for Education at Forbes Advisor. She completed her master’s in English at the University of Hawai‘i at Mānoa. Before coming to Forbes Advisor she worked on ...