11 2023 档案
去除内容中的多余br标签
摘要:def br2_br1(content): content = re.sub('<br>(\s+)<br>', '', content) content = re.sub(r"(<br>)\1+", r"\1", content) content = re.sub("<br>", '<br><br>
取标签列表的最后两位,并去除最后一个逗号,没有标签就用标题
摘要:def update_biaoqian(tag_list, title): if tag_list == [''] or tag_list == []: print('没有标签,取标题作为标签') titless = re.sub('\s', ',', title) tag_list = title
把列表换成JSON格式,并根据键取值
摘要:def get_all(content, keyword): keys = [] values = [] for specs in keyword: num = keyword.index(specs) keys.append(specs) if num <= len(keyword) - 2: v
去除列表里的空格
摘要:def del_nt(title_list): title_new = [] for title_old in title_list: title = re.sub('\s', '', title_old) if title == '': pass else: title_new.append(ti