python--获取网页图片
来源:互联网 发布:如何理解js面向对象 编辑:程序博客网 时间:2024/05/07 11:45
#导入类
import urllib
import re
#定义函数
def getHtml(url):
page = urllib.urlopen(url)
html = page.read()
return html
def getPic(html):
reg = r'src="(.+?\.jpg)" '
imgre = re.compile(reg)
imglist = re.findall(imgre,html)
x = 0
for imgurl in imglist:
urllib.urlretrieve(imgurl,'%s.jpg' % x)
x+=1
#调用函数
html = getHtml("http://news.baidu.com")
getPic(html)
这是我写的第一个简单的python程序,python很强大,自己会一直学下去。。。
0 0
- python--获取网页图片
- python 爬虫获取网页图片
- Python 爬虫:获取网页图片
- python 爬虫 获取网页中的图片
- python获取网页中所有图片并筛选指定分辨率
- 获取网页图片
- 获取网页中的图片
- python抓取网页图片
- python抓取网页图片
- Python下载网页图片
- Python 抓网页图片
- Python网页图片爬虫
- Python抓取网页图片
- python抓取网页图片
- Python爬虫网页图片
- Python抓取网页图片
- Python 获取网页内容
- python 获取网页header
- DevExpress v15.1:ASP.NET WebForms功能增强(一)
- 计蒜客 难题题库 134 求出现次数最多的字符
- HQL select总结
- 网站静态化(转)
- strlen函数,strcat函数,strcpy函数,strncpy函数,strcmp函数实现
- python--获取网页图片
- POJ 1611The Suspects 并查集
- win7下编译python源码
- Restler 的使用
- poj 1470 Closest Common Ancestors 【并查集 求根 + 求解每一个节点是多少对(a,b)的LCA】
- 计蒜客 难题题库 135 数字加1
- CodeForces 3C-Tic-tac-toe
- LASSOS方程--图像降噪
- 自定义导航条1