File size: 619 Bytes
c4f8f49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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")