2017-10-12 1 views
0
<div class="fullwidth singleCalender"><table border="0" cellpadding="4" 
cellspacing="0"> 

<tbody> 
<tr style="display: table-row;"> 
<th colspan="7" style="text-align: right; font-weight: normal; padding: 0px 
8px;">Oct&nbsp;2018</th> 

</tr> 

<tr style="display: table-row;"> 
<td>Mo</td><td>Tu</td><td>We</td><td>Th</td><td>Fr</td><td>Sa</td> 
<td>Su</td> 
</tr> 

<tr style="display: none;"> 
<td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td> 
</tr> 

<tr style="display: table-row;"> 
<td>8</td> 
<td>9</td> 
<td> 
<a title="Start of event" style="text-decoration: 
none; background-color: rgb(144, 155, 31); color: rgb(255, 255, 255); font- 
size: 14px; border-radius: 1px; padding: 0px 5px;">10</a> 
</td> 
<td> 
<a title="Start of event" style="text-decoration: none; background- 
color: rgb(144, 155, 31); color: rgb(255, 255, 255); font-size: 14px; 
border-radius: 1px; padding: 0px 5px;">11</a> 
</td> 
<td> 
<a title="Start of event" 
style="text-decoration: none; background-color: rgb(144, 155, 31); color: 
rgb(255, 255, 255); font-size: 14px; border-radius: 1px; padding: 0px 
5px;">12</a> 
</td> 
<td><a title="Start of event" style="text-decoration: none; 
background-color: rgb(144, 155, 31); color: rgb(255, 255, 255); font-size: 
14px; border-radius: 1px; padding: 0px 5px;">13</a> 
</td><td>14</td> 
</tr> 


<tr style="display: none;"> 
<td>15</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td> 
<td>21</td> 
</tr> 

<tr style="display: none;"> 
<td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td> 
<td>28</td> 
</tr> 

<tr style="display: none;"> 
<td>29</td><td>30</td><td>31</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp; 
</td><td>&nbsp;</td> 
</tr> 

</tbody> 
</table> 
</div> 

wie 10, 11, 12, 13 Werte mit Titel = "Start des Ereignisses" eines Tags in tds erhalten. von oben Code in Python mit Scrapy? Kann mir bitte jemand helfen? Danke im Voraus ..! Ich habe versucht mit diesem Code "response.css ('div.fullwidth Tabelle tbody tr: nth-Kind (4) td a.Start :: Text'). Extract()" Aber ich bekomme o/p gefällt das "[]".Wie bekomme ich Daten aus aufgeführten Td-Tags in Python mit Scrapy aufgelistet?

Antwort

0

Versuchen Sie folgendes:

response.xpath('//a[contains(@title, "Start of event")]/text()').extract() 
+0

sorry..its nicht working..im bekommen o/p als [] .. – rajeshbojja

+0

Wirklich? Ich habe es gerade getestet. Kopierte den HTML-Code in 'text' -Variable, manuell erstellt 'scrapy.Selector (text = text)' und versuchte 'sel.xpath (' // a [enthält (@title," Start of event ")]/text() ') .extract() 'mit Erfolg '[u'10', u'11 ', u'12', u'13 ']' wie erwartet. –

+0

ja ... reall ich bekomme das gleiche o/p .... [] – rajeshbojja

Verwandte Themen