2022-2-21 06:42| 发布者: 笨鸟自学网| 查看: 5872| 评论: 0
将JSON格式的项导出到指定的类似文件的对象,每行写入一个JSON编码的项。额外的 __init__ 方法参数传递给 BaseItemExporter __init__ 方法,以及对 JSONEncoder __init__ 方法,因此可以使用任何 JSONEncoder __init__ 方法参数自定义此导出器。
__init__
BaseItemExporter
JSONEncoder
file -- 用于导出数据的类似文件的对象。它的 write 方法应接受 bytes (以二进制模式打开的磁盘文件, io.BytesIO 物体等)
write
bytes
io.BytesIO
该出口商的典型产出为:
{"name": "Color TV", "price": "1200"} {"name": "DVD player", "price": "200"}
不同于 JsonItemExporter ,此导出程序生成的格式非常适合序列化大量数据。
JsonItemExporter
Archiver|手机版|笨鸟自学网 ( 粤ICP备20019910号 )
GMT+8, 2025-8-31 00:54 , Processed in 0.027562 second(s), 19 queries .
Powered by Discuz! X3.5
© 2001-2017 Discuz Team. Template By 【未来科技】【 www.wekei.cn 】