赞
踩
初次系统的学习python,在学习完基本语法后,对爬虫进行学习,现在对当当网进行爬取,爬取了基本图书信息,包括图书名、作者等
- import requests
- from time import sleep
- from lxml import etree
- class dangdang_spider():
- #定义爬虫类
- def __init__(self):
- self.url="http://category.dangdang.com/pg{}-cp01.00.00.00.00.00.html" #爬虫网址
- self.headers= {#设置headers
- 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) Ap
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。