我想从这里提取地址“Calle Tiera Del Soconusco No. 252”。
<td class="type-address"><span>Calle Tiera Del Soconusco No. 252 </span></td>
我已经尝试了以下代码,但我无法获得必要的信息。
infor = response2.xpath("td[2]/td[contains(@class,'type-address')]").get()
infor2= response2.xpath("td[2]/@class").get()
1条答案
按热度按时间wvmv3b1j1#
所以父元素是一个类为“type-address”的
<td>
,那么父元素有一个实际包含文本的子元素<span>
。所以试试看: