201180721 从豆瓣图书 Top 250下载全部图片

#!/usr/bin/env python
# encoding: utf-8
#导入模块
import re
import urllib
from bs4 import BeautifulSouphtml

f=urllib.urlopen('https://book.douban.com/top250?start=225')
htmlCode = f.read()
htmlCode.find('src')
imageList=re.findall(r'src="(.*?\.(jpg|png))"',htmlCode)
j=1
for i in imageList :
imageUrl = i[0]
urllib.urlretrieve(imageUrl,'./images/%d.jpg'%j)
j+=1python

相关文章
相关标签/搜索