from lxml.html.clean import Cleaner
response =unicode(response.content, "utf-8")
清除css格式
cleaner = Cleaner(style=True, scripts=True, page_structure=False, safe_attrs_only=False)
response = etree.HTML(cleaner.clean_html(response))
from lxml.html.clean import Cleaner
response =unicode(response.content, "utf-8")
清除css格式
cleaner = Cleaner(style=True, scripts=True, page_structure=False, safe_attrs_only=False)
response = etree.HTML(cleaner.clean_html(response))
本文标题:lxml转码 乱码问题
本文链接:https://www.haomeiwen.com/subject/ygngqftx.html
网友评论