python 爬去优酷会员表情
import urllib
import os
import re
//地址
context = urllib.urlopen(url).read() //读取网页内容保存
res = re.findall('http://static.youku.com/v1.0.1082/index/img/vip_emotion/wanwan/*.gif',context) //查找图片链接
os.chdir('D:\\ext') //图片存储路径 ,os.getcwd()可以读取路径
for i in range(len(res)):
name = str(i) + ‘.jpg’
f = open(name,'wb')
f.write(urllib.urlopen(res[i]).read())
//下载到本地
f.close() //关闭文档占用
--积跬步,至千里!--