# coding:utf-8 from util.htmltag import CleanKeepTable from typing import AnyStr from loguru import logger class AttachHelper(object): @staticmethod def __clear_tag(content: AnyStr) -> AnyStr: """ 清理标签 :param content: :return: """ try: tag_html = CleanKeepTable(content) # 保留 table标签 except Exception as e: logger.warning(e) return content return tag_html @staticmethod def __add_space(content_html): """ 为表格添加空格 :param content_html: :return: """ if "" in content_html: content_html = content_html.replace('', '') if "
AnyStr: """ 处理开始 :param content: :return: """ content = self.__add_space(content) content = self.__clear_tag(content) return content