Thanks Rolando,
working just fine. Appreciate the help here
Brendan
On Sunday, February 2, 2014 7:04:37 PM UTC+11, BrendanB wrote:
>
> Hi,
>
> I'm just trying to loop through a list of li tags and extract the *label*and
> the
> *value*.
>
> I have the following code, but I cant seem to extact the data:
>
> def _load_product_details(self, il):
> sel = il.selector
> tab = sel.css('.product-attribute.cms li')
> label_list = tab.xpath('.//*[@class="product-attribute
> cms"]/li/*[@class="label"]')
> value_list = tab.xpath('.//*[@class="product-attribute
> cms"]/li/*[@class="value"]')
>
> for li in zip(label_list, value_list):
> il.add_value(to_key(_x(li.css('::text'))),
> _x(li.css('::text')))
>
>
> <!-- Example Code -->
> <ul class="product-attribute cms">
> <li class="cfx odd">
> <div class="label">Size</div>
> <div class="value">Single</div>
> </li>
> <li class="cfx even">
> <div class="label">Style</div>
> <div class="value">Contemporary</div>
> </li>
> <li class="cfx odd">
> <div class="label">Categories</div>
> <div class="value">Beds</div>
> </li>
> </ul>
>
>
> thanks
> Brendan
>
--
You received this message because you are subscribed to the Google Groups
"scrapy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/groups/opt_out.