【文本清洗/编码解码转换】将从网页爬取的数据中含有以&#开头的乱码,转为可读的字符串

本文针对爬虫获取的文本中出现的以 '&#' 开头的乱码问题进行探讨,旨在通过处理函数将其转换为正常可读的字符串。内容包括问题描述、清洗目标以及实现转换的代码示例。
摘要由CSDN通过智能技术生成

问题描述

在对从网页爬取的字符串做处理时,发现掺杂了形如**&#712**的乱码,示例如下:

"Mother Mary Teresa Bojaxhiu[6] (born Anjezë Gonxhe Bojaxhiu, Albanian: [aˈɲɛzə ˈɡɔndʒɛ bɔjaˈdʒiu]; 26 August 1910 – 5 September 1997), honoured in the Catholic Church as Saint Teresa of Calcutta,[7] was an Albanian-Indian[4] Roman Catholic nun and missionary."

清洗目标

"Mother Mary Teresa Bojaxhiu[6] (born Anjezë Gonxhe Bojaxhiu, Albanian: [aˈɲɛzə ˈɡɔndʒɛ bɔjaˈdʒiu]; 26 August 1910 – 5 September 1997), honoured in the Catholic Church as Saint Teresa of Calcutta,[7] was an Albanian-Indian[4] Roman Catholic nun and missionary."

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值