【发布时间】:2018-05-11 11:19:39
【问题描述】:
这是使用python从websource中提取的xml或html web数据,它是表格格式,我希望只将** **标记的数据放在一个数组中作为[][]如何做?单个数组也可以一一存储。
我的想法是将符号 BHEL 及其值 80.50 作为一个单独的元素,以便我可以将其用于我的编码。
<table width="100%"><tr><td>
<div class="tphead"><h2>Option Chain (Equity Derivatives)</h2></div>
</td><td align="right">
<div style="float:right; font-size:1.2em;">
<span>**Underlying Stock:** <b style="font-size:1.2em;">**BHEL** **80.50**</b> </span>
<span>**As on May 11, 2018 15:30:30 IST**<a> <img onclick="refresh();" src="/live_market/resources/images/refressbtn.gif" style="cursor: pointer" title="refresh"/></a></span></div>
</td></tr></table>
我只想过滤这些数据,并将其一个一个地存储为一个数组。
数组应如下所示。任何python代码支持都可以在这里提供。
Option Chain (Equity Derivatives)
Underlying Stock: BHEL 80.50
As on
May 11, 2018
15:30:30 IST
【问题讨论】:
标签: python python-3.x web-scraping beautifulsoup