how to get text value of title attribute of anchor tag in python

how to get text value of title attribute of anchor tag in your python?
<td class="col_name" nowrap="nowrap">
<a class="icon" title="refer me">
<img src="https://edu.au/images/icons/silk/vcard.gif" align="top" 
alt="Add to address book">
</a>
Mrs Cal <span class="hl_fcc">B</span>AREN
</td>

2 ways:

Using CSS:
response.css('td.col_name a::attr(title)').extract_first()
Using XPath:
response.xpath('//td[@class="col_name"]/a/@title').extract_first()

猜你喜欢

转载自blog.csdn.net/u014229742/article/details/81938384