Python网络爬虫实训:如何下载韩寒博客文章

根据智普培训视频,将抓取韩寒博客文章的Python代码记录如下:


#coding:utf-8

import urllib
import time

url = ['']*350
page = 1
link = 1
while page <= 7:
    con = urllib.urlopen('http://blog.sina.com.cn/s/articlelist_1191258123_0_'+str(page)+'.html').read()
    i = 0
    title = con.find(r'


你可能感兴趣的:(Python)