#encoding: utf-8 ''' 模块功能: 日期:2015-09-25 版本:1.0 ''' import urllib import re#------------ 筛选方法 --------------- def get_informtion(html_code,regular): #regular = '<h2>位置信息</h2>.*?</div>.*?<ul>.*?<li>.*?<strong>(.*?)</strong>.*?<span>(.*?)</span>' pattern = re.compile(regular,re.S) return re.findall(pattern,html_code) #---------- 楼盘详细信息 ------- def houses_more_infor(url): global number html_code = get_html_code(url) # 从楼盘首页得到户型图网址 regular = '<li class="">.*?<a class="statis-log" data-statis="FCAS-14-011" href="(.*?)">户型</a>.*?</li>' for item in get_informtion(html_code,regular): s = head+item print s#def get_html_code():f = urlopen(url)return f.read() (.*?)就是item值
url 爬虫 1
最新推荐文章于 2023-03-06 13:05:29 发布