2017-10-12 5 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> 

tdのタグのtitle = "イベント開始"で10,11,12,13の値を取得する方法。上のコードからpythonを使用して?誰でも助けてくれますか? Thanx in advance ..!私はこのコード "response.css( 'div.fullwidth table tbody tr:nth-​​child(4)td a.Start :: text')を試しました。extract()" しかし、私はこの "[]"のようなo/p。scrapyを使ってpythonでリストされたtdタグのリストに日付を表​​示するには?

答えて

0

これを試してみてください:

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

sorry..itsが.. []として – rajeshbojja

+0

を取得して、O/Pを本当にworking..imありませんか?私はちょうどそれをテストした。 HTMLを 'text'変数にコピーし、' scrapy.Selector(text = text) 'を手動で作成し、' sel.xpath( '// a [(@title、 "Start of event")/ text() ).extract() 'を実行し、期待通りに' [u'10 '、u'11'、u'12 '、u'13'] 'を返します。 –

+0

はい... reall私は同じo/pを得ています.... [] – rajeshbojja

関連する問題