scrapy删除html标签

    科技2023-09-19  101

    使用re和w3lib模块

    import re from w3lib.html import remove_tags # scrapy移除内容中多余的html标签 @classmethod def go_remove_tag(cls, value): # 移除html标签 value = remove_tags(value) # 移除空格 换行 return re.sub(r'[\t\r\n\s]', '', value)

     

    Processed: 0.050, SQL: 9