【发布时间】:2020-07-08 21:17:50
【问题描述】:
以下代码示例:
<div class="accordion-content" data-tab-content="" role="tabpanel" aria-labelledby="fmh1ij-accordion-label" aria-hidden="true" id="fmh1ij-accordion">
Number of Seats: Seventeen (17) certified seats for take-off & landing - including jump seat
<br>
Forward Cabin: Four (4) place executive club seats with pull-out tables
<br>
Mid Cabin: Four (4) place conference group opposite three (3) place 16G divan
<br>
Aft Cabin: Two (2) place executive club seats opposite three (3) place 16G divan
<br>
Lavatory Location(s): Forward crew lavatory and fully enclosed aft lavatory
<br>
我需要提取 'div class=accordion-content' 下面的内容。有没有办法使用 id 来做到这一点? 'id="fmh1ij-手风琴"?
我需要提取的内容:
“座位数:十七 (17) 等。 前舱:四 (4) 个等..."
我尝试了下面的代码,但没有成功。
response.xpath("//div[contains(@id,'fmh1ij-accordion')]//text()").extract()
【问题讨论】:
标签: html python-3.x xpath web-scraping scrapy