不同环境搜索结果不同

Different search results in different environments

我正在学习数据科学,在做题时,我发现了一个奇怪的现象。问题是使用 python 在 Beautiful Soup 主页上打印字符串 'Soup' 的出现次数。奇怪的是,iPython笔记本和Python出现的次数不同,当我运行在网页上手动搜索时结果完全不同

如果有人能给出一个合理的解释,我会很高兴。我附上了代码片段和结果:

在Python

在Pandas

手动

如您所见,结果在所有环境中都不同,在 Python 中出现 39 次,在 Pandas 中出现 41 次,通过手动搜索显示 35 次。

谢谢

我认为 Python 只找到 39,因为 2 缺少的是 <head>:

<title>Beautiful Soup: We called him Tortoise because he taught us.</title>
<meta name="Description" content="Beautiful Soup: a library designed for screen-scraping HTML and XML.">

您可以通过 Source of the page 进行检查 - 出现了 41 次。

如果手动检查webpage(出现35次),urls中有4次,<head>中有2,所以加起来41:

<a href="http://www.crummy.com/software/BeautifulSoup/bs3/documentation.html">Here's
the Beautiful Soup 3 documentation.</a>
<a href="download/3.x/BeautifulSoup-3.2.1.tar.gz">3.2.1</a> 
<a href="/source/software/BeautifulSoup/index.bhtml">
<a href="http://www.crummy.com/software/BeautifulSoup/">