【问题标题】:How to concat two values in one column using import.io如何使用 import.io 在一列中连接两个值
【发布时间】:2016-12-07 04:51:42
【问题描述】:

我正在使用 import.io 为 newegg.com 编写提取器。从列表页面获取价格值时,我面临一个困难。

  <div class="item-price-now">
    <span>from</span>
     $
    <strong>108</strong>
    <sup>.00</sup>
    </div>

价格包含在两个节点中,strongsup。我想获得 108.00 作为一个节点。当我尝试遵循 Xpath 时,我在两个节点中获取值。

//div[@class="item-price-now"]//strong/text() | //div[@class="item-price-now"]//sup/text()

提前致谢。

【问题讨论】:

    标签: import.io


    【解决方案1】:

    您可以使用 xpath 来抓取 div 中的所有文本,然后使用正则表达式将其过滤到美元后面的文本。

    xpath://div[@class='item-price-now'] -> from $108.00

    正则表达式:\$d+\.\d+ -> $108.00

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-07
      • 1970-01-01
      • 2022-08-18
      • 1970-01-01
      • 2020-05-13
      • 1970-01-01
      相关资源
      最近更新 更多