我正在从下面的tweet中删除文本。你知道吗
.@mikhailaleshin on drivers scared of the #Indy500: "They just have small **. ... That’s the only explanation." -
我正在对网站的源代码执行正则表达式:
page = urllib.urlopen(url).read()
soup = BeautifulSoup(page, "html.parser")
soup_string = str(soup)
tweet_text = re.search(ur'<title*?>(.*)</title>', soup_string).group(1)
但当我把它打印到我的屏幕上时,我得到了:
.@mikhailaleshin on drivers scared of the #Indy500: "They just have small **. ... ThatÔÇÖs the only explanation."
所以引号’
变成了ÔÇÖ
。我的最佳选择是,这是某种编码问题,但我不知道如何解决它。你知道吗
(或)
如果是unicode错误,那么上面的一个应该解决这个错误。你知道吗
这是一个解决办法
相关问题 更多 >
编程相关推荐