有时候我们需要清洗数据,里面有超链接,怎么去掉他们,比如下面的问题

><em>View More Works</em></div></a></div></li></ul></div>

 

 

第一种方法:

  用这则替换,把 href 替换为 hre1f 就可以了,

第二种方法:

        result_div_list = re.findall('<(.*?)>',str(result_div))
       
    
if 'href' in str(result_div_list): for ii in result_div_list: if 'href' in ii: item_desc = str(result_div).replace(str(ii) ,'') else: item_desc = result_div

记录下来,供以后学习参考 

 

相关文章:

  • 2019-02-26
  • 2021-05-25
  • 2021-10-01
  • 2021-12-23
  • 2021-11-02
  • 2021-11-15
  • 2021-10-28
猜你喜欢
  • 2022-02-09
  • 2021-09-27
  • 2022-12-23
  • 2018-12-29
  • 2022-02-07
  • 2022-12-23
相关资源
相似解决方案