为什么这个findAll请求不返回任何数据

时间:2016-09-28 17:10:19

标签: python beautifulsoup python-requests

所以,我试图从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

0 个答案:

没有答案