使用SCrapy提取数据

时间:2014-09-01 12:50:13

标签: python scrapy

我是python和scrapy的初学者 我需要帮助,我从不同的销售网站计算机中提取数据。 我需要计算机的品牌或标记,网站上的标记是图像的问题 我的代码:

marks = hxs.select('//*[@id="produit_liste_marque"]/a/img/@src').extract()

我需要将图片转换为文本,例如:

<img src="http://www.tunisianet.com.tn/3/small/Lenovo.jpg" alt="Lenovo" title="Lenovo" border="0"> 

到联想

还是有一种提取图片标题的方法?

1 个答案:

答案 0 :(得分:0)

只需使用@attribute从标记中获取属性。

在这种情况下marks = hxs.select('//*[@id="produit_liste_marque"]/a/img/@title').extract()