import re with open("modules/research_tab.py", "r", encoding="utf-8") as f: lines = f.readlines() new_lines = [] for line in lines: if 'stats_html\n' in line and '""' in line: line = line.replace('stats_html\n', 'stats_html, ""\n') elif 'stats_html\n' in line and 'ref_md' in line: line = line.replace('stats_html\n', 'stats_html, ""\n') elif 'stats_html' in line and ')' in line and 'yield' not in line: if '_build_section_cards_html({})' in line or 'Detenido' in line: line = line.replace('stats_html', 'stats_html, ""') elif 'sections_map' in line or 'accumulated_report' in line or 'empty_df' in line: line = line.replace('stats_html', 'stats_html, accumulated_report') new_lines.append(line) with open("modules/research_tab.py", "w", encoding="utf-8") as f: f.writelines(new_lines)