9

Python爬虫编程思想(48):项目实战:抓取起点中文网的小说信息

 3 years ago
source link: https://blog.csdn.net/nokiaguy/article/details/120679917
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爬虫编程思想(48):项目实战:抓取起点中文网的小说信息

专栏收录该内容
48 篇文章 2 订阅 ¥29.90 ¥99.00

        本文会利用requests库抓取起点中文网上的小说信息,并通过XPath提取相关的内容,最后将经过提取的内容保存到Excel文件中。本例需要使用第三方的xlwt库,该库用来通过Python操作Excel文件,需要使用下面的命令安装xlwt库。

pip install xlwt

        使用xlwt库非常简单,首先需要创建一个workbook,相当于一个Excel文件,然后在workbook中添加若干个Sheet,接下来在每一个Sheet中的指定单元格(Cell)添加文本,最后使用workbook的save方法保存Excel文件。完整的实现代码如下:


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK