import os, time import sys import re def read_old_part(filename, start, end): content = [] recording = False with open(filename) as f: for line in f: line = line.strip() if line == end: break if recording: content.append(line) if line == start: recor