この表から通貨レートを示すデータを抽出したいと思います。このテーブルからデータを取得するhtml python
私はこのアプローチを試してみましたが、そのこれは私もしかし、私は得ることができますPythonのセレンのアプローチを試してみましたが、HTML
</td>
<td valign="top" class="OuterProdCell test">
<table class="ProductCell">
<tr>
<td class="rateCountryFlag">
<ul id="prodImages">
<li>
<a href="/travel-money/buy-chilean-peso" title="Buy Chilean Peso" class="flags chilean-peso" ></a>
</li>
</ul>
</td>
<td class="ratesName">
<a href="/travel-money/buy-chilean-peso" title="Buy Chilean Peso">
Chilean Peso</a>
</td>
<td class="ratesClass">
<a class="orderText" href="/travel-money/buy-chilean-peso" title="Buy Chilean Peso">774.8540</a>
</td>
<td class="orderNow">
<ul id="prodImages">
<li>
<a class="reserveNow" href="/travel-money/buy-chilean-peso" title="Buy Chilean Peso">Order<br/>now</a>
</li>
<li>
<a href="/travel-money/buy-chilean-peso" title="Buy Chilean Peso" class="flags arrowGreen" ></a>
</li>
</ul>
</td>
</tr>
</table>
ある
table_id = driver.find_element(By.ID,
'data_configuration_feeds_ct_fields_body0')
rows = table_id.find_elements(By.TAG_NAME, "tr") # get all of the
rows in the table
for row in rows:
col = row.find_elements(By.TAG_NAME, "td")[1] #note: index start from
0, 1 is col 2
print(col.text) #prints text from the element
を働いていない訪問https://www.iceplc.com/travel-money/exchange-rates
それぞれの通貨で、名前は含まれていません。
driver.get("https://www.iceplc.com/travel-money/exchange-
rates")
rates = driver.find_elements_by_class_name("ratesClass")
for rate in rates:
print(rate.text)
?予想される出力は何ですか? –
出力ユーロ1.146 – xys234
この形式でテーブル全体を出力することを意味します。 – xys234