保存数据到json文件

# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.exporters import JsonItemExporter class ErshouPipeline(object):
def open_spider(self, spider):
self.file=open('01ershou.json','wb')
self.exporter=JsonItemExporter(self.file)
self.exporter.start_exporting() def process_item(self, item, spider):
self.exporter.export_item(item)
return item def close_spider(self, spider):
self.exporter.finish_exporting()
self.file.close()

最新文章

  1. 18.实现如下类之间的继承关系,并编写Music类来测试这些类。
  2. strlen和sizeof的区别
  3. 【Python】[函数] 函数的参数与递归函数
  4. display:inline-block 在IE6中实现{转}
  5. WinForms 新窗体后台打开完美的解决
  6. Codeforces #345 Div.1
  7. 域名系统DNS和FTP
  8. Python初探
  9. 对于ArrayList中的泛型进行分析
  10. <HTML>初识HTML
  11. python re模块记录
  12. Roller5.0.3安装配置部署 step by step
  13. Python爬虫——小说
  14. hexo上部署博客到Github失败
  15. 20145234黄斐《Java程序设计》课程总结
  16. IntelliJ IDEA 自动编译功能无法使用,On 'update' action:选项里面没有update classes and resources这项
  17. c++计算器后续(3)
  18. static变量和final变量
  19. Markdown 学习
  20. Android NDK r8 Cygwin CDT 在window下开发环境搭建 安装配置与使用 具体图文解说

热门文章

  1. python 装饰器 第三步:使用语法糖
  2. js设置cookies
  3. __str__和__repr__的区别
  4. 45.Sort List(链表排序)
  5. C#socket客户端自己输入消息发送到服务端通信实现通信
  6. oracle创建表空间自增空间管理
  7. line vty 0 4的意义
  8. memcache、mongodb、redis的对比区别
  9. Android面向切面编程(AOP)(转)
  10. Tmux 中开启鼠标选择与复制