search

Home  >  Q&A  >  body text

python - scrapy xpath 问题

Response.body中有

<tr>
    <td style="vertical-align:top;">Copper, Cu</td>
    <td class="dataCell" style="vertical-align:top;"><= 0.03 %<span class="dataCondition"></span></td>
    <td class="dataCell" style="vertical-align:top;"><= 0.03 %<span class="dataCondition"></span></td>
    <td class="dataComment" style="vertical-align:top;"></td>
</tr>

之后运行
**response.xpath('/tr').extract()
只能获取到**

<tr>
    <td style="vertical-align:top;">Copper, Cu&nbsp;</td>
    <td class="dataCell" style="vertical-align:top;"></td>
    <td class="dataCell" style="vertical-align:top;"></td>
    <td class="dataComment" style="vertical-align:top;"></td>
</tr>

的出来的结果
<= 0.03 % 和 <span></span>消失不见,为什么呢?

伊谢尔伦伊谢尔伦2777 days ago772

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 10:19:32

    It may be asynchronously loaded data

    reply
    0
  • Cancelreply