#!/usr/bin/python3 import re import time # get list of chapters chapters = [] for line in open('index.html', encoding="utf-8"): if not line.count('
©'): include = False if line.count('
".format(id_prefix, x.group(1)), line) line = same_chapter_fragment_href.sub(lambda x: "", line) line = chapter_fragment_href.sub(lambda x: "".format(x.group(1).replace('.html', ''), x.group(2)) , line) out.write(line) out.write("