zoukankan      html  css  js  c++  java
  • eclipse+PyDev 中报错"scrapy.spiders.Spider" ,可用"# @UndefinedVariable"压制.

    # -*- 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)
    

      

  • 相关阅读:
    CF1270H
    CF1305G
    LeetCode-Sqrt(x)
    LeetCode-Plus One
    LeetCode-Integer to Roman
    LeetCode-Roman to Integer
    LeetCode-String to Integer (atoi)
    LeetCode-Reverse Integer
    C++
    LeetCode-Gray Code
  • 原文地址:https://www.cnblogs.com/juedui0769/p/4903184.html
Copyright © 2011-2022 走看看