Spaces:
Running on Zero
Running on Zero
| with open("app.py", "r") as f: | |
| lines = f.readlines() | |
| new_lines = [] | |
| i = 0 | |
| while i < len(lines): | |
| if "stats = f" in lines[i] and "## Results" in lines[i] and "\\n" not in lines[i]: | |
| new_lines.append(" stats = f\"## Results\n\n**Entered:** {total_in}\n**Exited:** {total_out}\n**Net:** {total_in - total_out}\n\n\" | |
| ") | |
| while i < len(lines) and not (lines[i].strip() == "\"" or lines[i].strip().startswith("for cls")): | |
| i += 1 | |
| continue | |
| new_lines.append(lines[i]) | |
| i += 1 | |
| with open("app.py", "w") as f: | |
| f.writelines(new_lines) | |
| print("Done") | |