import pathlib all_content = [] return_count = 0 hour_count = 0 for file in pathlib.Path("logs_plain").glob("*.txt"): with open(file, "r") as f: return_count += f.read().count("[ENTER]") hour_count += 1 lines_per_hour = return_count // hour_count for file in pathlib.Path("logs_summaries").glob("*.txt"): with open(file, "r") as f: all_content.append(f.read()) with open("logs_summaries/merged.txt", "w") as f: f.write("\n\n".join(all_content)) html_content = ['', """ """, '
', '', f'Total lines written: {return_count}', '