requests后用 soup.find 找不到指定标签的原因分析

在实践中,用 Microsoft Edge 浏览器打开了 www.santostan.com 进行BeautifulSoup.find()方法的学习实践,开发工具看到的源代码如下:

requests后用 soup.find 找不到指定标签的原因分析_第1张图片

我想找到选中的标签,所以用了如下的代码:

import requests
from bs4 import BeautifulSoup

headers = {'user-agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gec'
                          + 'ko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362',
           "host" : "www.santostang.com",
           }
link = "http://www.santostang.com/"
r = requests.get(link,headers=headers,timeout=15)
soup = BeautifulSoup(r.text,"html.parser")
print(soup.prettify())
sp = soup.find("div",id="titleBar")
print("\nsp = ",sp)

但得到的结果是:

你可能感兴趣的:(爬虫程序,Python)