猿问

为啥我的xpath 匹配不到呢?

<div class="img"><a target="_blank" href="http://news.pedaily.cn/201806/432662.shtml"><img src="https://static.pedaily.cn/head/css/images/noimage.png"  data-src="https://pic2.pedaily.cn/default/scenery2/other/306330.jpg"  alt="6小时起伏,荣耀手机618排名大逆转,荣耀倪嘉悦:手机行业到了换机时期"></a></div>

<h3><a href="http://news.pedaily.cn/201806/432662.shtml" target="_blank">6小时起伏,荣耀手机618排名大逆转,荣耀倪嘉悦:手机行业到了换机时期</a></h3>

<div class="tag"><span class="date">2018-06-21 10:10</span>

<a href="http://www.pedaily.cn/tag/235880/" target="_blank">京东618</a><a href="http://www.pedaily.cn/tag/190820/" target="_blank">华为荣耀</a><a href="http://www.pedaily.cn/tag/82753/" target="_blank">小米</a>

</div>

</li>

xpath:

  title_list=etree.HTML(response.content.decode('utf-8')).xpath('//div[@class="img"]/a[contains(@target,"_blank")]/@alt')

青春有我
浏览 874回答 1
1回答
随时随地看视频慕课网APP
我要回答