Use text mode to open more files. Use \n instead of os.linesep, since python converts newlines to \n when reading files in text mode.