当我在命令行中运行此代码时; scrapy crawl确实-o items.csv,我收到一行输出,每行之间有空格。见图。我该如何解决这个问题?
import scrapy
class IndeedSpider(scrapy.Spider):
name = 'indeed'
allowed_domains = ['indeed.nl']
start_urls = ['https://www.indeed.nl/vacatures?q=developer&l=']
def parse(self, response):
jobs =response.xpath('//div[@class=" row result" or
@class="lastRow row result"]')
for job in jobs:
jobtitle = job.xpath('h2/a/@title').extract_first()
company =
job.xpath('.//span[@class="company"]/text()').extract_first()
yield{
'jobtitle': jobtitle,
'company': company}