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: