from lxml.html import etree content = "***************" html = etree.HTML(str(content)) html_data = html.xpath('//span/text()|//p//text()|//section//text()') datas = [data.replace("\r", "").replace("\n", '').replace('\t', '').replace('\xa0', '') for data in list(html_data)] ori_content = ' '.join([d for d in datas if d])