CSV导出-使用scrapy抓取-o output.csv的列排序 [英] CSV Exports - Ordering of columns using scrapy crawl -o output.csv
本文介绍了CSV导出-使用scrapy抓取-o output.csv的列排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用-o参数在CSV输出中指定列的顺序?
Is there a way to specify the order of the columns in a CSV output using the -o parameter?
它似乎遵循随机顺序,并且不遵循items.py文件中的顺序,也没有遵循刮擦中填充项目字段的顺序.
It seems to follow a random order and does not follow the order in the items.py file or when the item fields get populated in the scrape.
谢谢!
推荐答案
有一个相关的 field_to_export
属性 .exporter.CsvItemExporter"rel =" nofollow noreferrer> CsvItemExporter
,但是据我所知,无法从命令行进行设置.您需要通过管道完成此操作,请参阅:
There is a relevant field_to_export
attribute in CsvItemExporter
, but, as far as I understand, there is no way to set it from the command-line. You need to do it through the pipeline, see:
这篇关于CSV导出-使用scrapy抓取-o output.csv的列排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文