【发布时间】:2020-10-07 07:07:04
【问题描述】:
我想从表格中抓取股票代码并检查“最终结算价格”行中是否存在某些关键字{“GD”,“每日价格”,“TSI”}。在表中,有多个动态列。 下面是一个例子: 我想抓取“Ambuja Cements Futures”的股票代码,即“ZACE”并将其存储在列表中,并检查“最终结算价格”行中是否存在某些关键字。
这是股票代码行的 HTML 代码:
<tr>
<th>Ticker Symbol</th>
<td>ZADS</td>
<td>ZACE</td>
<td>ZAPN</td>
<td>ZARB</td>
<td>ZAXS</td>
<td>ZBJA</td>
<td>ZBAF</td>
<td>ZBPC</td>
<td>ZBHA</td>
<td>ZBHI</td>
<td>ZBOS</td>
<td>ZCIP</td>
<td>ZCOA</td>
<td>ZDRR</td>
<td>ZEIM</td>
<td>ZGAI</td>
<td>ZHCL</td>
<td>ZHDB</td>
<td>ZHMC</td>
<td>ZHND</td>
<td>ZHPC</td>
<td>ZHUV</td>
<td>ZHDF</td>
<td>ZICI</td>
<td>ZIHF</td>
<td>ZIOC</td>
<td>ZIIB</td>
<td>ZINF</td>
<td>ZITC</td>
<td>ZKMB</td>
<td>ZLT</td>
<td>ZLPC</td>
<td>ZMM</td>
<td>ZMSI</td>
<td>ZNTP</td>
<td>ZONG</td>
<td>ZPWG</td>
<td>ZRIL</td>
<td>ZSBI</td>
<td>ZSUN</td>
<td>ZTCS</td>
<td>ZTTM</td>
<td>ZTAT</td>
<td>ZTEC</td>
<td>ZUTC</td>
<td>ZUPL</td>
<td>ZVED</td>
<td>ZWPR</td>
<td>ZYES</td>
<td>ZZEE</td>
</tr>
这是最终结算价格行的 HTML 代码:
<tr>
<th>Final Settlement Price</th>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.
<br>
</td>
<td></td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.
<br>
</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.
<br>
</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
<td>The Final Settlement Price for the Contracts will be the official closing price of the Underlying Shares on the Last Trading Day, rounded to 2 decimal places, expressed as US dollars.</td>
</tr>
您可以访问相同的网站:https://www.sgx.com/derivatives/products/indiassf?cc=ZADS
【问题讨论】:
-
您能否正确缩进您的问题中的 HTML?您可以找到在线 HTML 格式化程序,让这一切变得简单快捷。
-
请同时添加您正在使用的python代码来抓取文本。
-
@GregBurghardt 在这里。我更新了 HTML 代码。但是,由于字数限制,我无法上传完整代码。您可以通过单击该网站的链接来查看。我尝试用硒来废弃这个,但没有成功。因此,如果您能提供解决方案,我将不胜感激。
标签: python selenium web-scraping beautifulsoup html-table