07 2023 档案

摘要:内容里有特殊字符,用re.escape(pattern)转义一下 阅读全文
posted @ 2023-07-27 15:27 布都御魂 阅读(457) 评论(0) 推荐(1)
摘要:# 把所有br标签换成一个br标签content = re.sub(r"(<br>)\1+", r"\1", content)# 把一个换成2个br标签content = re.sub("<br>", '<br><br>', content)print(f'展示图片原图片:{picurl}') 阅读全文
posted @ 2023-07-25 16:46 布都御魂 阅读(49) 评论(0) 推荐(0)
摘要:删除内容中的表情符号 import emoji import re def del_emoji(text): text = emoji.demojize(text) result = re.sub(':\S+?:', ' ', text) result = result.replace("(●'◡' 阅读全文
posted @ 2023-07-19 16:29 布都御魂 阅读(94) 评论(0) 推荐(0)
摘要:# 提取img标签 tree_img = etree.HTML(content) width = tree_img.xpath('//img//@width')[0] height = tree_img.xpath('//img//@height')[0] # 替换掉width=,和height= 阅读全文
posted @ 2023-07-14 09:58 布都御魂 阅读(107) 评论(0) 推荐(0)
摘要:import hashlib import random import re import time from lxml import etree import pymysql import requests def strip_tags(string, allowed_tags=''): if a 阅读全文
posted @ 2023-07-12 16:00 布都御魂 阅读(53) 评论(0) 推荐(0)
摘要:list1 = ['组', '2023-1-1', '2023-1-2', '2023-1-3', '总业绩'] list2 = ['一组', '1', '2', '3', '6'] list3 = ['二组', '4', '5', '6', '15'] list4 = ['三组', '7', '8 阅读全文
posted @ 2023-07-11 16:45 布都御魂 阅读(29) 评论(0) 推荐(0)
摘要:list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # 输出结果[1,2,3][4,5,6][7.8.9] len_list = len(list) // 3 num_list = len(list) % 3 list_all = [] for num in range(l 阅读全文
posted @ 2023-07-11 16:09 布都御魂 阅读(13) 评论(0) 推荐(0)
摘要:def strip_tags(string, allowed_tags=''): if allowed_tags != '': # Get a list of all allowed tag names. allowed_tags = allowed_tags.split(',') allowed_ 阅读全文
posted @ 2023-07-10 11:01 布都御魂 阅读(11) 评论(0) 推荐(0)