import os import time from urllib.request import urlopen website = urlopen("http://www.nu.nl/").readlines() saved = [] need_to_copy = 0 baseline = -1 for line in website: line = line.decode("utf-8") if("zone clearfix" in line): baseline = if(need_to_copy > 0): need_to_copy = need_to_copy - 1 saved.append(line) for line in saved: print(line)