<p>这是基于我认为你想要的,但是没有适当的数据样本是不可能说的。我猜不出它是怎么构成的。在您的描述中,数据听起来是不规则的,这在您的示例中是不可能看到的。在</p>
<pre><code>from bs4 import BeautifulSoup
from itertools import izip
html = """<div class="yui-u first yfi-start-content">
<div class="yfi_quote_summary">
<div id="yfi_quote_summary_data" class="rtq_table">
<table id="table1">
<tr>
<th scope="row" width="48%">Target Point:</th>
<td class="yfnc_tabledata1">200.22</td>
</tr>
<tr>
<th scope="row" width="48%">Target Point:</th>
<td class="yfnc_tabledata1">200.22</td>
</tr>
<tr>
<th scope="row" width="48%">Target Point:</th>
<td class="yfnc_tabledata1">200.22</td>
</tr>
</table>
</div>
</div>
</div>"""
bs = BeautifulSoup(html)
result = {}
ths = bs.findAll("th")
tds = bs.findAll("td")
elements = izip(ths, tds)
result = []
for x, y in elements:
result.append((x.text, y.text))
print result
</code></pre>
<p>编辑:</p>
<p>Yahoo API解决方案,请考虑使用此解决方案:</p>
^{pr2}$
<p>这将打印:</p>
<pre><code>565.07
561.78
</code></pre>
<p>以下是股票的可用数据:</p>
<pre><code>AfterHoursChangeRealtime
AnnualizedGain
Ask
AskRealtime
AverageDailyVolume
Bid
BidRealtime
BookValue
Change
Change_PercentChange
ChangeFromFiftydayMovingAverage
ChangeFromTwoHundreddayMovingAverage
ChangeFromYearHigh
ChangeFromYearLow
ChangeinPercent
ChangePercentRealtime
ChangeRealtime
Commission
Currency
DaysHigh
DaysLow
DaysRange
DaysRangeRealtime
DaysValueChange
DaysValueChangeRealtime
DividendPayDate
DividendShare
DividendYield
EarningsShare
EBITDA
EPSEstimateCurrentYear
EPSEstimateNextQuarter
EPSEstimateNextYear
ErrorIndicationreturnedforsymbolchangedinvalid
ExDividendDate
FiftydayMovingAverage
HighLimit
HoldingsGain
HoldingsGainPercent
HoldingsGainPercentRealtime
HoldingsGainRealtime
HoldingsValue
HoldingsValueRealtime
LastTradeDate
LastTradePriceOnly
LastTradeRealtimeWithTime
LastTradeTime
LastTradeWithTime
LowLimit
MarketCapitalization
MarketCapRealtime
MoreInfo
Name
Notes
OneyrTargetPrice
Open
OrderBookRealtime
PEGRatio
PERatio
PERatioRealtime
PercebtChangeFromYearHigh
PercentChange
PercentChangeFromFiftydayMovingAverage
PercentChangeFromTwoHundreddayMovingAverage
PercentChangeFromYearLow
PreviousClose
PriceBook
PriceEPSEstimateCurrentYear
PriceEPSEstimateNextYear
PricePaid
PriceSales
SharesOwned
ShortRatio
StockExchange
symbol
Symbol
TickerTrend
TradeDate
TwoHundreddayMovingAverage
Volume
YearHigh
YearLow
YearRange
</code></pre>