#!/usr/bin/env python3 import os import fileinput import re import sys modTag = "mod" file_path_html = 'glife.html' file_path_mod = 'mods/mod.html' data = '' modData = '' with open(file_path_html, 'r') as file: data = file.read() i = 0 regex = r"""(.*?)""" for match in re.finditer(regex,data,re.S): tags = match.group(3).split() if(modTag in tags): modData += match.group(0)+'\n' i += 1 if(i % 100 == 0): print(i) with open(file_path_mod, 'w') as file: file.write(modData) print('Done')