python  获取网页图片 十月底的 一弹

#!/usr/bin/python
import re
import urllib

def getHtml(url):
    page=urllib.urlopen(url)
    html=page.read()
    #print html
    return html


def getImg(html):
    reg =r'(/.*?(jpg|gif|png|bmp))'
    imgre=re.compile(reg)
    imglist=re.findall(imgre,html)
    return imglist

html=getHtml("http://music.163.com/#/song?id=401832721")

print getImg(html)

posted @ 2016-10-29 16:16  保安保洁保姆外卖快递  阅读(142)  评论(0编辑  收藏  举报