所以,我试图从www.theweathernetwork.com中提取温度值,当我检查元素时,我得到以下结构:
<div class="mainTemp-wrap">
<p class="temperature">
14
<span>
°C
</span>
</p>
<p class="mcity-feels-like">Feels like
<span>13</span>
</p>
</div>
但是当我运行以下代码时,我什么都没有回复:
import requests
from bs4 import BeautifulSoup
url = "https://www.theweathernetwork.com/us/weather/illinois/chicago"
r = requests.get(url)
soup = BeautifulSoup(r.content)
g_data = soup.findAll("p", {"class": "temperature"})
print g_data