问题描述
使用scrapy crawl books -o books.csv输出的文件中,数据之间是隔行输入的。
解决方案
To fix this in Scrapy 1.3, you can patch it by adding newline='' as parameter to io.TextIOWrapper in the __init__method of the CsvItemExporter class in scrapy.exporters.
本文介绍如何解决Scrapy爬虫使用CsvItemExporter导出CSV文件时出现的数据隔行问题。通过在Scrapy 1.3版本中对CsvItemExporter类进行补丁修复,可以在导出CSV文件时避免数据隔行的现象。
使用scrapy crawl books -o books.csv输出的文件中,数据之间是隔行输入的。
To fix this in Scrapy 1.3, you can patch it by adding newline='' as parameter to io.TextIOWrapper in the __init__method of the CsvItemExporter class in scrapy.exporters.

被折叠的 条评论
为什么被折叠?