CSV 导出 - 使用 scrapy crawl -o output.csv 对列进行排序 [英] CSV Exports - Ordering of columns using scrapy crawl -o output.csv

查看:21
本文介绍了CSV 导出 - 使用 scrapy crawl -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 属性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 crawl -o output.csv 对列进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆