I want to remove these from my output: I want these only Wave Coffee Collection
JavaScript
x
2
1
'nntt3rd Wave Coffee Collectionnttttnt'
2
This is my code :
JavaScript
1
24
24
1
from scrapy.http import Request
2
import scrapy
3
class PushpaSpider(scrapy.Spider):
4
name = 'pushpa'
5
start_urls = ['https://onepagelove.com/inspiration']
6
7
8
def parse(self, response):
9
books = response.xpath("//div[@class='thumb-image']//a//@href").extract()
10
for book in books:
11
absolute_url = response.urljoin(book)
12
yield Request(absolute_url, callback=self.parse_book)
13
14
def parse_book(self, response):
15
title = response.xpath("//span[@class='review-name']//h1//text()").extract_first()
16
17
18
19
yield{
20
'title':title
21
}
22
23
24
Advertisement
Answer
If this is your resulting output:
JavaScript
1
2
1
result = 'nntt3rd Wave Coffee Collectionnttttnt'
2
Then you can easily achieve your desired output like this:
JavaScript
1
2
1
result = result.strip()
2