#!/usr/bin/env python3 import os import fileinput import re import sys file_path_html = 'glife.html' deprecatedTag = "deprecated" data = '' with open(file_path_html, 'r') as file: data = file.read() dataLengthInitial = len(data) dataWithoutDeprecated = data i = 0 regex = r"""(.*?)""" for match in re.finditer(regex,data,re.S): tags = match.group(3).split() if(deprecatedTag in tags): dataWithoutDeprecated = dataWithoutDeprecated.replace(match.group(0),'') print('Removed:'+match.group(2)) with open(file_path_html, 'w') as file: file.write(dataWithoutDeprecated) dataLengthEnd = len(dataWithoutDeprecated) print(f'POSTCOMPILE DONE, REMAINING SIZE {round(dataLengthEnd/dataLengthInitial*100,1)}%')