赞
踩
为了更好的学习scrapy库,我决定先其前驱内容lxml库
此次我们爬取豆瓣电影Top250
代码如下:
import requests
from lxml import etree
import time
import csv
headers={
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36'
}
fp=open('F://textcode/doubant250.csv','wt',encoding='utf-8')
writer=csv.writer(fp)
writer.writerow(('ranking','name',
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。