items.py

class LianhezaobaospyderItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
# pass
body=scrapy.Field()
link=scrapy.Field()

爬虫.py

from .. import items

def parse_news(self,response):
item=items.LianhezaobaospyderItem()
item['body']=response.xpath("//div[@class='xx']/text()").get()
item['link']=response.url
yield item

item和字典类似,数据量大时,字典可能键值对错误

最新文章

  1. Coursera台大机器学习课程笔记6 -- The VC Dimension
  2. delphi.数据结构.链表
  3. spring MVC学习笔记
  4. 【转】深入理解const char*p,char const*p,char *const p,const char **p,char const**p,char *const*p,char**const p
  5. jquery 温故而知新 Ul 相关的操作
  6. codeforces 361 D - Friends and Subsequences
  7. 你不知道的This和Class
  8. mac os 系统密码正确的 但是进不了系统
  9. 【转】一个windows线程池实现
  10. 大表 update 方式
  11. C++----练习--while求和
  12. px-rem自适应转换
  13. 学习笔记6-Android查看应用输出的错误信息 如何部署应用到真实手机 发布软件
  14. PS抠图简单粗暴2种方法
  15. Jenkins自动化部署-----持续交付【转】
  16. scapy 中的ARP
  17. windows删除文件或目录CMD命令
  18. Delphi: TLabel设置EllipsisPosition属性用...显示过长文本时,以Hint显示其全文本
  19. go语言中的坑
  20. Hive在drop表的时候报错

热门文章

  1. Vue Cli 报错:You are using the runtime-only build of Vue where the template compiler is not availabl
  2. TCP连接过程及报文解析
  3. “Too many texture interpolators would be used for ForwardBase pass”
  4. python 类C数组的两种形式:list -->内容可变, tuple --->内容不可变
  5. 华为设备RIP实施和理论详解
  6. JAVA大数几算--HDU 2054 A == B ?
  7. python(类多态)
  8. HBase Filter 过滤器之RowFilter详解
  9. 手写实现java栈结构,并实现简易的计算器(基于后缀算法)
  10. turtle库应用实例-五角星绘制