Hi Friends,

I am struggling for quite some time now on this issue.This is the table 
from which i need to extract Annual div instead of Annual Div yield. 

<table class="horizontalTable col1of3 lastCol"><tbody><tr 
class="first"><th>Annual div <span class="sub">(TTM)</span></th><td>5.49 
<span class="currencyCode">GBX</span></td></tr><tr><th>Annual div yield 
<span class="sub">(TTM)</span></th><td>6.04%</td></tr><tr><th>Div 
ex-date</th><td><span class="nowrap">Sep 25 2013</span></td></tr><tr 
class="last"><th>Div pay-date</th><td><span class="nowrap">Nov 22 
2013</span></td></tr></tbody></table>


I wrote this XPATH query but it is bringing both Annual div and Annual div 
yield 

Annual_div = sel.xpath('//table[contains(@class, "horizontalTable 
col1of3")]/tbody/tr[th[contains(.,"Annual div")]]').extract()


u'<tr class="first"><th>Annual div <span 
class="sub">(TTM)</span></th><td>5.49 <span 
class="currencyCode">GBX</span></td></tr>', u'<tr><th>Annual div yield 
<span class="sub">(TTM)</span></th><td>5.83%</td></tr>']


When i write match on extant text then the doesn't yield any result. 


Annual_div = sel.xpath('//table[contains(@class, "horizontalTable 
col1of3")]/tbody/tr[th[text()="Annual div"]]').extract()


It seems it is to do with the span (TTM) i am not sure how to concatenate 
both Annual div (TTM) to come up with exact match.


Please help me.


Regards



-- 
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/d/optout.

Reply via email to