四、获取远程URL图片
#!/usr/bin/python # -*- coding: UTF-8 -*- import re import urllib def getHtml(url): page = urllib.urlopen(url) html = page.read() return html def getImg(html): reg = r'src=\'(.+?\.jpg)\'' imgre = re.compile(reg) imglist = re.findall(imgre,html) print(imglist.__len__()) return imglist str = getHtml("http://www.ln2car.com") print(getImg(str));