2

Python爬虫编程思想(147):在PyCharm中使用Scrapy

 2 years ago
source link: https://blog.csdn.net/nokiaguy/article/details/124994018
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Python爬虫编程思想(147):在PyCharm中使用Scrapy

        前面的例子是通过文本编辑器编写的,但在实际的开发中不可能用文本编辑器编写整个网络爬虫,所以需要选择一个IDE。我推荐目前最流行的PyCharm作为Python IDE。

        PyCharm不支持建立Scrapy工程,所以要先使用上一节介绍的方法通过命令行方式创建一个工程,然后再使用PyCharm创建一个普通的Python工程,将包含spiders子目录的myscrapy目录和scrapy.cfg文件复制到新建立的Python工程中。为了能直接在Python工程中运行网络爬虫,需要在myscrapy目录中建立一个execute.py脚本文件(文件名可以任意起),然后输入下面的代码。

        如果要运行其他的网络爬虫,只需要修改上面代码中字符串里面的命令即可。

        使用scrapy命令创建的工程包含两个myscrapy目录࿰


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK