posts - 431,  comments - 344,  trackbacks - 0

import re

name = '''you test this is for mae <img src="/upload/images/123455.jpg"/>, test for you just liook <img src="/upload/images/1test455.jpg"/>'''
result = re.findall('<img src="(.*?)"/>', name, re.S)
print result



结果为:
['/upload/images/123455.jpg', '/upload/images/1test455.jpg']

当然如何你的img标签和src属性之间还有其他属性, 则你也可以直接取src, 如:
result = re.findall('src="(.*?)"/>', name, re.S)
posted on 2009-05-26 21:15 周锐 阅读(1164) 评论(0)  编辑  收藏 所属分类: Python

只有注册用户登录后才能发表评论。


网站导航: