python求教运行爬虫结不报错但没有文件的输出,请指教

python 专栏收录该内容
0 篇文章 0 订阅

python爬虫问题求教,程序能够运行,但不能输出到文件,甚至都没有新建文本文件,请大神指教

2019-02-24 18:46:23 [scrapy.utils.log] INFO: Scrapy 1.6.0 started (bot: weather)
2019-02-24 18:46:23 [scrapy.utils.log] INFO: Versions: lxml 4.3.1.0, libxml2 2.9.5, cssselect 1.0.3, parsel 1.5.1, w3lib 1.20.0, Twisted 18.9.0, Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)], pyOpenSSL 19.0.0 (OpenSSL 1.1.1a 20 Nov 2018), cryptography 2.5, Platform Windows-10-10.0.17134-SP0
2019-02-24 18:46:23 [scrapy.crawler] INFO: Overridden settings: {‘BOT_NAME’: ‘weather’, ‘NEWSPIDER_MODULE’: ‘weather.spiders’, ‘SPIDER_MODULES’: [‘weather.spiders’]}
2019-02-24 18:46:23 [scrapy.extensions.telnet] INFO: Telnet Password: dbc9ded506154659
2019-02-24 18:46:24 [scrapy.middleware] INFO: Enabled extensions:
[‘scrapy.extensions.corestats.CoreStats’,
‘scrapy.extensions.telnet.TelnetConsole’,
‘scrapy.extensions.logstats.LogStats’]
2019-02-24 18:46:24 [scrapy.middleware] INFO: Enabled downloader middlewares:
[‘scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware’,
‘scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware’,
‘scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware’,
‘scrapy.downloadermiddlewares.retry.RetryMiddleware’,
‘scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware’,
‘scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware’,
‘scrapy.downloadermiddlewares.redirect.RedirectMiddleware’,
‘scrapy.downloadermiddlewares.cookies.CookiesMiddleware’,
‘scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware’,
‘scrapy.downloadermiddlewares.stats.DownloaderStats’]
2019-02-24 18:46:24 [scrapy.middleware] INFO: Enabled spider middlewares:
[‘scrapy.spidermiddlewares.httperror.HttpErrorMiddleware’,
‘scrapy.spidermiddlewares.offsite.OffsiteMiddleware’,
‘scrapy.spidermiddlewares.referer.RefererMiddleware’,
‘scrapy.spidermiddlewares.urllength.UrlLengthMiddleware’,
‘scrapy.spidermiddlewares.depth.DepthMiddleware’]
2019-02-24 18:46:24 [scrapy.middleware] INFO: Enabled item pipelines:
[‘weather.pipelines.WeatherPipeline’]
2019-02-24 18:46:24 [scrapy.core.engine] INFO: Spider opened
2019-02-24 18:46:24 [scrapy.extensions.logstats] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
2019-02-24 18:46:24 [scrapy.extensions.telnet] INFO: Telnet console listening on 127.0.0.1:6023
2019-02-24 18:46:25 [scrapy.core.engine] DEBUG: Crawled (200) <GET http://www.tianqi.com/wuhan/> (referer: None)
2019-02-24 18:46:25 [scrapy.core.engine] DEBUG: Crawled (200) <GET http://www.tianqi.com/shanghai/> (referer: None)
2019-02-24 18:46:25 [scrapy.core.engine] INFO: Closing spider (finished)
2019-02-24 18:46:25 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
{‘downloader/request_bytes’: 345,
‘downloader/request_count’: 2,
‘downloader/request_method_count/GET’: 2,
‘downloader/response_bytes’: 63527,
‘downloader/response_count’: 2,
‘downloader/response_status_count/200’: 2,
‘finish_reason’: ‘finished’,
‘finish_time’: datetime.datetime(2019, 2, 24, 10, 46, 25, 421382),
‘log_count/DEBUG’: 2,
‘log_count/INFO’: 9,
‘response_received_count’: 2,
‘scheduler/dequeued’: 2,
‘scheduler/dequeued/memory’: 2,
‘scheduler/enqueued’: 2,
‘scheduler/enqueued/memory’: 2,
‘start_time’: datetime.datetime(2019, 2, 24, 10, 46, 24, 670356)}
2019-02-24 18:46:25 [scrapy.core.engine] INFO: Spider closed (finished)

wuhanspider:
import scrapy
from weather.items import WeatherItem

class WuhanspiderSpider(scrapy.Spider):
name = ‘wuhanSpider’
allowed_domains = [‘www.tianqi.com’]
start_urls = []
citys=[‘wuhan’,‘shanghai’]
for city in citys:
start_urls.append(‘

  • 0
    点赞
  • 2
    评论
  • 0
    收藏
  • 打赏
    打赏
  • 扫一扫,分享海报

评论 2 您还未登录,请先 登录 后发表或查看评论
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页

打赏作者

木行者枫

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值