python - 为什么 beautifulsoup 没有为该表返回任何内容?

标签 python beautifulsoup wunderground

我正在尝试从此 Wunderground 页面中提取特定的表格: https://www.wunderground.com/history/daily/us/ma/nantucket/KACK/date/2018-7-29

用简单的英语来说,该表称为“每日观察”。

从页面检查来看,表ID是history-observation-table

我尝试过使用 BeautifulSoup,但我能想到的所有查找表(或任何表)的方法都不起作用。

page = requests.get('https://www.wunderground.com/history/daily/us/ma/nantucket/KACK/date/2018-7-29').text


soup = bs(page.content,'html.parser')

soup.find_all("table")

结果什么都没有/空。我可以找到标题和 div,但如果我寻找特定的类 div,则无法找到。为什么我无法拉动这张 table ?

最佳答案

页面正在使用 javascript 渲染表格,因此 BeautifulSoup 不会知道它在那里。您可以使用 selenium 获取正确的页面源并将其输入到 soup 对象中!

您需要install selenium此时您的脚本将变为:

from bs4 import BeautifulSoup as bs
from selenium import webdriver
import time

browser = webdriver.Chrome() # or some other browser
browser.get('https://www.wunderground.com/history/daily/us/ma/nantucket/KACK/date/2018-7-29')
time.sleep(2)
soup = bs(browser.page_source, 'html.parser')

print(soup.find_all("table"))

最好将 time.sleep() 替换为 selenium waits

当我运行上面的脚本时,它会输出很长的内容:

[<table _ngcontent-c14="" id="stationselector_table">
<tbody _ngcontent-c14="">
<!-- -->
</tbody>
</table>, <table _ngcontent-c7="">
<!-- --><!-- -->
<thead _ngcontent-c7="">
<tr _ngcontent-c7="">
<th _ngcontent-c7="">Temperature (° F)</th>
<!-- --><td _ngcontent-c7="">Actual</td><td _ngcontent-c7="">Historic Avg.</td><td _ngcontent-c7="">Record</td>
<td _ngcontent-c7="" style="height: 5px; width:10px;">
<svg _ngcontent-c7="" height="5" style="display: block" width="10" xmlns="http://www.w3.org/2000/svg"><polygon _ngcontent-c7="" fill="#000000" points="0,5 5,0 10,5"></polygon></svg>
</td>
</tr>
</thead>
<tbody _ngcontent-c7="">
<!-- --><tr _ngcontent-c7="">
<th _ngcontent-c7="">High Temp</th>
<!-- --><td _ngcontent-c7="">80</td><td _ngcontent-c7="">0</td><td _ngcontent-c7="">90</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">Low Temp</th>
<!-- --><td _ngcontent-c7="">66</td><td _ngcontent-c7="">0</td><td _ngcontent-c7="">53</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">Day Average Temp</th>
<!-- --><td _ngcontent-c7="">74</td><td _ngcontent-c7="">0</td><td _ngcontent-c7="">-</td>
</tr>
</tbody>
<!-- -->
<thead _ngcontent-c7="">
<tr _ngcontent-c7="">
<th _ngcontent-c7="">Precipitation (Inches)</th>
<!-- --><td _ngcontent-c7="">Actual</td><td _ngcontent-c7="">Historic Avg.</td><td _ngcontent-c7="">Record</td>
<td _ngcontent-c7="" style="height: 5px; width:10px;">
<svg _ngcontent-c7="" height="5" style="display: block" width="10" xmlns="http://www.w3.org/2000/svg"><polygon _ngcontent-c7="" fill="#000000" points="0,5 5,0 10,5"></polygon></svg>
</td>
</tr>
</thead>
<tbody _ngcontent-c7="">
<!-- --><tr _ngcontent-c7="">
<th _ngcontent-c7="">Precipitation</th>
<!-- --><td _ngcontent-c7="">0</td><td _ngcontent-c7="">0</td><td _ngcontent-c7="">2.4</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">Month to Date</th>
<!-- --><td _ngcontent-c7="">0</td><td _ngcontent-c7="">0</td><td _ngcontent-c7="">-</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">Year to Date</th>
<!-- --><td _ngcontent-c7="">0</td><td _ngcontent-c7="">0</td><td _ngcontent-c7="">-</td>
</tr>
</tbody>
<!-- -->
<thead _ngcontent-c7="">
<tr _ngcontent-c7="">
<th _ngcontent-c7="">Degree Days (° F)</th>
<!-- --><td _ngcontent-c7="">Actual</td><td _ngcontent-c7="">Historic Avg.</td><td _ngcontent-c7="">Record</td>
<td _ngcontent-c7="" style="height: 5px; width:10px;">
<svg _ngcontent-c7="" height="5" style="display: block" width="10" xmlns="http://www.w3.org/2000/svg"><polygon _ngcontent-c7="" fill="#000000" points="0,5 5,0 10,5"></polygon></svg>
</td>
</tr>
</thead>
<tbody _ngcontent-c7="">
<!-- --><tr _ngcontent-c7="">
<th _ngcontent-c7="">Heating Degree Days</th>
<!-- --><td _ngcontent-c7="">0</td><td _ngcontent-c7="">0</td><td _ngcontent-c7="">-</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">HDD Month to Date</th>
<!-- --><td _ngcontent-c7="">0</td><td _ngcontent-c7="">0</td><td _ngcontent-c7="">-</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">HDD Since July 1</th>
<!-- --><td _ngcontent-c7="">0</td><td _ngcontent-c7="">0</td><td _ngcontent-c7="">-</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">Cooling Degree Days</th>
<!-- --><td _ngcontent-c7="">9</td><td _ngcontent-c7="">0</td><td _ngcontent-c7="">-</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">CDD Month to Date</th>
<!-- --><td _ngcontent-c7="">0</td><td _ngcontent-c7="">0</td><td _ngcontent-c7="">-</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">CDD Year to Date</th>
<!-- --><td _ngcontent-c7="">0</td><td _ngcontent-c7="">0</td><td _ngcontent-c7="">-</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">Growing Degree Days</th>
<!-- --><td _ngcontent-c7="">24</td><td _ngcontent-c7="">-</td><td _ngcontent-c7="">-</td>
</tr>
</tbody>
<!-- -->
<thead _ngcontent-c7="">
<tr _ngcontent-c7="">
<th _ngcontent-c7="">Dew Point (° F)</th>
<!-- --><td _ngcontent-c7="">Actual</td><td _ngcontent-c7="">Historic Avg.</td><td _ngcontent-c7="">Record</td>
<td _ngcontent-c7="" style="height: 5px; width:10px;">
<svg _ngcontent-c7="" height="5" style="display: block" width="10" xmlns="http://www.w3.org/2000/svg"><polygon _ngcontent-c7="" fill="#000000" points="0,5 5,0 10,5"></polygon></svg>
</td>
</tr>
</thead>
<tbody _ngcontent-c7="">
<!-- --><tr _ngcontent-c7="">
<th _ngcontent-c7="">Dew Point</th>
<!-- --><td _ngcontent-c7="">70</td><td _ngcontent-c7="">-</td><td _ngcontent-c7="">-</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">High</th>
<!-- --><td _ngcontent-c7="">72</td><td _ngcontent-c7="">-</td><td _ngcontent-c7="">-</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">Low</th>
<!-- --><td _ngcontent-c7="">65</td><td _ngcontent-c7="">-</td><td _ngcontent-c7="">-</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">Average</th>
<!-- --><td _ngcontent-c7="">70</td><td _ngcontent-c7="">-</td><td _ngcontent-c7="">-</td>
</tr>
</tbody>
<!-- -->
<thead _ngcontent-c7="">
<tr _ngcontent-c7="">
<th _ngcontent-c7="">Wind (MPH)</th>
<!-- --><td _ngcontent-c7="">Actual</td><td _ngcontent-c7="">Historic Avg.</td><td _ngcontent-c7="">Record</td>
<td _ngcontent-c7="" style="height: 5px; width:10px;">
<svg _ngcontent-c7="" height="5" style="display: block" width="10" xmlns="http://www.w3.org/2000/svg"><polygon _ngcontent-c7="" fill="#000000" points="0,5 5,0 10,5"></polygon></svg>
</td>
</tr>
</thead>
<tbody _ngcontent-c7="">
<!-- --><tr _ngcontent-c7="">
<th _ngcontent-c7="">Max Wind Speed</th>
<!-- --><td _ngcontent-c7="">9</td><td _ngcontent-c7="">-</td><td _ngcontent-c7="">-</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">Visibility</th>
<!-- --><td _ngcontent-c7="">10</td><td _ngcontent-c7="">-</td><td _ngcontent-c7="">-</td>
</tr>
</tbody>
<!-- -->
<thead _ngcontent-c7="">
<tr _ngcontent-c7="">
<th _ngcontent-c7="">Sea Level Pressure (Hg)</th>
<!-- --><td _ngcontent-c7="">Actual</td><td _ngcontent-c7="">Historic Avg.</td><td _ngcontent-c7="">Record</td>
<td _ngcontent-c7="" style="height: 5px; width:10px;">
<svg _ngcontent-c7="" height="5" style="display: block" width="10" xmlns="http://www.w3.org/2000/svg"><polygon _ngcontent-c7="" fill="#000000" points="0,5 5,0 10,5"></polygon></svg>
</td>
</tr>
</thead>
<tbody _ngcontent-c7="">
<!-- --><tr _ngcontent-c7="">
<th _ngcontent-c7="">Sea Level Pressure</th>
<!-- --><td _ngcontent-c7="">30.11</td><td _ngcontent-c7="">-</td><td _ngcontent-c7="">-</td>
</tr>
</tbody>
<!-- -->
<thead _ngcontent-c7="">
<tr _ngcontent-c7="">
<th _ngcontent-c7="">Astronomy</th>
<!-- --><td _ngcontent-c7="">Day Length</td><td _ngcontent-c7="">Rise</td><td _ngcontent-c7="">Set</td>
<td _ngcontent-c7="" style="height: 5px; width:10px;">
<svg _ngcontent-c7="" height="5" style="display: block" width="10" xmlns="http://www.w3.org/2000/svg"><polygon _ngcontent-c7="" fill="#000000" points="0,5 5,0 10,5"></polygon></svg>
</td>
</tr>
</thead>
<tbody _ngcontent-c7="">
<!-- --><tr _ngcontent-c7="">
<th _ngcontent-c7="">Actual Time</th>
<!-- --><td _ngcontent-c7="">14h 28m</td><td _ngcontent-c7="">5:33 AM</td><td _ngcontent-c7="">8:02 PM</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">Civil Twilight</th>
<!-- --><td _ngcontent-c7=""></td><td _ngcontent-c7="">5:02 AM</td><td _ngcontent-c7="">8:33 PM</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">Nautical Twilight</th>
<!-- --><td _ngcontent-c7=""></td><td _ngcontent-c7="">4:23 AM</td><td _ngcontent-c7="">9:12 PM</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">Astronomical Twilight</th>
<!-- --><td _ngcontent-c7=""></td><td _ngcontent-c7="">3:39 AM</td><td _ngcontent-c7="">9:56 PM</td>
</tr><tr _ngcontent-c7="">
<th _ngcontent-c7="">Moon: waning gibbous</th>
<!-- --><td _ngcontent-c7=""></td><td _ngcontent-c7="">9:13 PM</td><td _ngcontent-c7="">7:03 AM</td>
</tr>
</tbody>
</table>, <table _ngcontent-c17="" class="tablesaw-sortable" id="history-observation-table">
<thead _ngcontent-c17="">
<tr _ngcontent-c17="">
<!-- --><th _ngcontent-c17="">
<ngsaw-header _ngcontent-c17=""><span class="tablesaw-cell-persist tablesaw-sortable-head">
<button class="tablesaw-sortable-btn">Time</button>
</span></ngsaw-header>
</th><th _ngcontent-c17="">
<ngsaw-header _ngcontent-c17=""><span class="tablesaw-cell-persist tablesaw-sortable-head">
<button class="tablesaw-sortable-btn">Temperature</button>
</span></ngsaw-header>
</th><th _ngcontent-c17="">
<ngsaw-header _ngcontent-c17=""><span class="tablesaw-sortable-head">
<button class="tablesaw-sortable-btn">Dew Point</button>
</span></ngsaw-header>
</th><th _ngcontent-c17="">
<ngsaw-header _ngcontent-c17=""><span class="tablesaw-sortable-head">
<button class="tablesaw-sortable-btn">Humidity</button>
</span></ngsaw-header>
</th><th _ngcontent-c17="">
<ngsaw-header _ngcontent-c17=""><span class="tablesaw-sortable-head">
<button class="tablesaw-sortable-btn">Wind</button>
</span></ngsaw-header>
</th><th _ngcontent-c17="">
<ngsaw-header _ngcontent-c17=""><span class="tablesaw-sortable-head">
<button class="tablesaw-sortable-btn">Wind Speed</button>
</span></ngsaw-header>
</th><th _ngcontent-c17="">
<ngsaw-header _ngcontent-c17=""><span class="tablesaw-sortable-head">
<button class="tablesaw-sortable-btn">Wind Gust</button>
</span></ngsaw-header>
</th><th _ngcontent-c17="">
<ngsaw-header _ngcontent-c17=""><span class="tablesaw-sortable-head">
<button class="tablesaw-sortable-btn">Pressure</button>
</span></ngsaw-header>
</th><th _ngcontent-c17="">
<ngsaw-header _ngcontent-c17=""><span class="tablesaw-sortable-head">
<button class="tablesaw-sortable-btn">Precip.</button>
</span></ngsaw-header>
</th><th _ngcontent-c17="">
<ngsaw-header _ngcontent-c17=""><span class="tablesaw-sortable-head">
<button class="tablesaw-sortable-btn">Precip Accum</button>
</span></ngsaw-header>
</th><th _ngcontent-c17="">
<ngsaw-header _ngcontent-c17=""><span class="tablesaw-sortable-head">
<button class="tablesaw-sortable-btn">Condition</button>
</span></ngsaw-header>
</th>
</tr>
</thead>
<tbody _ngcontent-c17="">
<!-- -->
<!-- --><tr _ngcontent-c17="">
<!-- --><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- --><div>
<span>8:03 PM</span>
<!-- -->
</div>
<!-- -->
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test-true wu-unit wu-unit-temperature is-degree-visible">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">68</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->F
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test-true wu-unit wu-unit-temperature is-degree-visible">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">68</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->F
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-humidity">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">100</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->%
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- --><div>
<span>SSW</span>
<!-- -->
</div>
<!-- -->
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-speed">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">8</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->mph
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-speed">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">0</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->mph
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-pressure">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">29.9</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->in
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-rain">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">0.0</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->in
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-rain">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">0.0</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->in
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- --><div>
<span>Partly Cloudy</span>
<!-- -->
</div>
<!-- -->
</ng-saw-cell-parser>
</td>
</tr><tr _ngcontent-c17="">
<!-- --><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- --><div>
<span>8:09 PM</span>
<!-- -->
</div>
<!-- -->
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test-true wu-unit wu-unit-temperature is-degree-visible">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">69</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->F
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test-true wu-unit wu-unit-temperature is-degree-visible">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">69</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->F
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-humidity">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">100</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->%
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- --><div>
<span>SSW</span>
<!-- -->
</div>
<!-- -->
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-speed">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">9</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->mph
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-speed">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">0</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->mph
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-pressure">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">29.9</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->in
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-rain">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">0.0</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->in
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-rain">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">0.0</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->in
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- --><div>
<span>Mostly Cloudy</span>
<!-- -->
</div>
<!-- -->
</ng-saw-cell-parser>
</td>
</tr><tr _ngcontent-c17="">
<!-- --><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- --><div>
<span>8:51 PM</span>
<!-- -->
</div>
<!-- -->
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test-true wu-unit wu-unit-temperature is-degree-visible">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">70</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->F
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test-true wu-unit wu-unit-temperature is-degree-visible">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">70</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->F
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-humidity">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">100</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->%
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- --><div>
<span>SW</span>
<!-- -->
</div>
<!-- -->
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-speed">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">7</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->mph
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-speed">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">0</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->mph
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-pressure">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">29.9</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->in
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-rain">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">0.0</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->in
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-rain">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">0.0</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->in
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- --><div>
<span>Cloudy</span>
<!-- -->
</div>
<!-- -->
</ng-saw-cell-parser>
</td>
</tr><tr _ngcontent-c17="">
<!-- --><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- --><div>
<span>8:53 PM</span>
<!-- -->
</div>
<!-- -->
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test-true wu-unit wu-unit-temperature is-degree-visible">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">69</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->F
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test-true wu-unit wu-unit-temperature is-degree-visible">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">69</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->F
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-humidity">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">100</span> <span _ngcontent-c13="" class="wu-label">
<!-- -->%
    <!-- -->
</span>
<!-- -->
</span>
<!-- -->
</display-unit>
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- --><div>
<span>SW</span>
<!-- -->
</div>
<!-- -->
</ng-saw-cell-parser>
</td><td _ngcontent-c17="">
<ng-saw-cell-parser _ngcontent-c17=""><!-- -->
<!-- --><display-unit _nghost-c13=""><!-- --><span _ngcontent-c13="" class="test- wu-unit wu-unit-speed">
<!-- -->
<!-- -->
<!-- -->
<span _ngcontent-c13="" class="wu-value wu-value-to">7</span> <span _ngcontent-c13="" class="wu-label">
]

Process finished with exit code 0

实际上这是一个非常小的片段,因为我的帖子限制在 30,000 个字符...

关于python - 为什么 beautifulsoup 没有为该表返回任何内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56120108/

相关文章:

python - 在 Jupyter 笔记本上禁用下载

python - Beautiful Soup 4 CSS 选择器的工作方式与教程显示的不同

java - 我如何从 wunderground API 获取数据并在 Android 中显示在屏幕上?

python - 在 Python 中计算日期是开始、 future 还是现在

python - flask 错误 : "Method Not Allowed The method is not allowed for the requested URL"

Python:AttributeError: 'NoneType' 对象没有属性 'split'

python - 如何使用 Python 从 HTML 获取 href 链接?

python - 无法从 SPAN 标签获取文本

swift - 访问 Wunderground API 的 "dailysummary"部分时出现问题

java - 如何使用 JSoup 从 Android 中的 url 中的嵌入式 url 获取远程视频的直接链接?