Je ne sais pas quel type de sortie vous préférez. En supposant que votre résultat attendu est un élément par ligne de la table de données, et voici un exemple de code (vous devrez peut-être supprimer les promptions console ipython):
In [10]: for tr in response.xpath('//table/tbody/tr'):
...: item = dict()
...: item['title'] = tr.xpath('./td[@class="title"]/text()').extract_first().strip()
...: item['description'] = ','.join(x.strip() for x in tr.xpath('./td[@class="description"]//text()').extract())
...: item['pricePweek'] = tr.xpath('./td[@class="pricePweek"]//text()').extract_first().strip()
...: item['weeks'] = tr.xpath('./td[@class="weeks"]/text()').extract_first().strip()
...: item['bookFees'] = tr.xpath('./td[@class="bookFees"]/text()').extract_first().strip()
...: item['total'] = tr.xpath('./td[@class="total"]/text()').extract_first().strip()
...: item['sDate'] = tr.xpath('./td[@class="sDate"]/text()').extract_first().strip()
...: item['bookLink'] = tr.xpath('./td[@class="bookLink"]/a/@href').extract_first().strip()
...: print(item)
Et voici l'impression:
{'title': 'En-Suite (Ground Floor)', 'description': '10.5sqm,3/4 bed,En-suite Bathroom (WC, Basin and Bath),Use of ground floor communal kitchen', 'pricePweek': '£163.00', 'weeks': '50', 'bookFees': '£250.00', 'total': '£8,150.00', 'sDate': '23 Sep 2017', 'bookLink': 'https://www.crm-students.com/crm-accommodation/application-form/?tx_wistcas_booknow%5BroomType%5D=2917&tx_wistcas_booknow%5Bwait%5D=1&tx_wistcas_booknow%5BbookingPeriod%5D=5386&tx_wistcas_booknow%5Baction%5D=book0&tx_wistcas_booknow%5Bcontroller%5D=RoomType&cHash=3dd0f1b377330cfbad6327b728678cbd'}
{'title': 'En-Suite (Ground Floor)', 'description': '10.5sqm,3/4 bed,En-suite Bathroom (WC, Basin and Bath),Use of ground floor communal kitchen', 'pricePweek': '£163.00', 'weeks': '49', 'bookFees': '£250.00', 'total': '£7,987.00', 'sDate': '30 Sep 2017', 'bookLink': 'https://www.crm-students.com/crm-accommodation/application-form/?tx_wistcas_booknow%5BroomType%5D=2917&tx_wistcas_booknow%5Bwait%5D=1&tx_wistcas_booknow%5BbookingPeriod%5D=6075&tx_wistcas_booknow%5Baction%5D=book0&tx_wistcas_booknow%5Bcontroller%5D=RoomType&cHash=db85ff90cacb487ee98942d955141b09'}
{'title': 'Large Studio (Courtyard)', 'description': '22-23m,2,3/4 bed,Generous studio with same features as "Standard" but slightly larger,Dual Occupancy is available for an additional 20% of the advertised rate per week', 'pricePweek': '£223.00', 'weeks': '51', 'bookFees': '£250.00', 'total': '£11,373.00', 'sDate': '16 Sep 2017', 'bookLink': 'https://www.crm-students.com/crm-accommodation/application-form/?tx_wistcas_booknow%5BroomType%5D=718&tx_wistcas_booknow%5Bwait%5D=1&tx_wistcas_booknow%5BbookingPeriod%5D=5652&tx_wistcas_booknow%5Baction%5D=book0&tx_wistcas_booknow%5Bcontroller%5D=RoomType&cHash=e959ccd71b62be9211eb1dd3ad5b362c'}
{'title': 'Large Studio (Courtyard)', 'description': '22-23m,2,3/4 bed,Generous studio with same features as "Standard" but slightly larger,Dual Occupancy is available for an additional 20% of the advertised rate per week', 'pricePweek': '£223.00', 'weeks': '49', 'bookFees': '£250.00', 'total': '£10,927.00', 'sDate': '30 Sep 2017', 'bookLink': 'https://www.crm-students.com/crm-accommodation/application-form/?tx_wistcas_booknow%5BroomType%5D=718&tx_wistcas_booknow%5Bwait%5D=1&tx_wistcas_booknow%5BbookingPeriod%5D=6075&tx_wistcas_booknow%5Baction%5D=book0&tx_wistcas_booknow%5Bcontroller%5D=RoomType&cHash=5f798c129cfe56dead110ed5d80efa75'}
Notez que puisque certaines cellules contiennent d'autres éléments, vous devez les gérer correctement. Par exemple, la cellule de description contient une liste d'ordre, ici je les concatène par la séparation ,
.
Espérons que cela serait utile.
Merci
Au lieu de photos, essayez de placer ici un lien contenant les éléments de la table afin que vous puissiez avoir une réponse rapide. – SIM