html 处理之 w3lib

w3lib 是 scrapy 的基础插件,用来处理html,清理文本带有HTML标签的数据;

from w3lib.html import remove_tags, replace_tags
remove_tags(text, which_ones=(), keep=(), encoding=None)  # 去除所有HTML标签
replace_tags(text, token='', encoding=None)  # 替换所有HTML标签
w3lib.http.headers_raw_to_dict(headers_raw)  # 原始头转换成字典

 posted on 2022-01-19 11:46  Rannie`  阅读(95)  评论(0编辑  收藏  举报
去除动画
找回动画