【发布时间】:2020-02-25 14:45:12
【问题描述】:
我有以下 html 摘录:
<div class="price">
<span class="float-right"><strong>1900</strong> USD</span>
</div>
我想检索金额和货币作为两个单独的变量。
对于金额,我可以通过以下代码毫无问题地得到它:
price <- rentalagency_html %>%
rvest::html_nodes(css="div.price > span.float-right > strong") %>%
rvest::html_text(trim=TRUE)
price
对于货币,我怎样才能只得到“美元”而没有金额?基本上,我想排除标签。
【问题讨论】:
-
有网址可以分享吗?