标签:
# -*- coding:utf-8 -*- ‘‘‘ Created on 2015年10月22日 (1.1) 例子来源: http://scrapy-chs.readthedocs.org/zh_CN/latest/intro/tutorial.html ‘‘‘ import scrapy # 去掉 s 在PyDev中不报错, 但是无法运行.如果加上 s 虽然报错,但是程序能正常运行. # 可以在 PyDev 中使用 " # @UndefinedVariable "来压制错误提示. class DmozSpider(scrapy.spiders.Spider): # @UndefinedVariable name = "dmoz" allowed_domains = ["dmoz.org"] start_urls = [ "http://www.dmoz.org/Computers/Programming/Languages/Python/Books/", "http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/" ] def parse(self, response): filename = response.url.split("/")[-2] with open(filename, ‘wb‘) as f: f.write(response.body)
eclipse+PyDev 中报错"scrapy.spiders.Spider" ,可用"# @UndefinedVariable"压制.
标签:
原文地址:http://www.cnblogs.com/juedui0769/p/4903184.html