Skip to content Skip to sidebar Skip to footer

Export Python Data To Csv File

I'm trying to export my file via command line : scrapy crawl tunisaianet -o save.csv -t csv but nothing is happenning, any help? here is my code: import scrapy import csv from tf

Solution 1:

I assume you are getting these errors:

ERROR: Spider must return Request, BaseItem, dict or None, got 'tuple'in <GET http://www.tunisianet.com.tn/466-consoles-jeux>

which specifically says what's wrong, you are returning tuples as items, change your yield code to:

...
item['prix'] = response.xpath('//*[contains(@class, "price")]/text()').extract()[i]
yield item

Post a Comment for "Export Python Data To Csv File"