编程实现 自动获取每天深圳一手房二手房的成交量与成交面积
2016-10-12 15:59
288 查看
原文链接:http://30daydo.com/article/106
静观其变,目前的态势不宜参与进去。
每天自动获取深圳上海北京的新房二手房的成交量
静观其变,目前的态势不宜参与进去。
每天自动获取深圳上海北京的新房二手房的成交量
#-*-coding=utf-8-*- __author__ = 'rocky' #获取每天深圳一手房,二手房的成交套数与面积,并且写入数据库 #主要就是正则表达抓取几个数字 import urllib2,re import database def getContent(): url="http://ris.szpl.gov.cn/" one_hand="credit/showcjgs/ysfcjgs.aspx" second_hand="credit/showcjgs/esfcjgs.aspx" req=urllib2.Request(url+one_hand) content=urllib2.urlopen(req).read() #返回的就是网页的源码,没有做任何防爬虫的处理,zf网站,呵呵 #print content date=re.compile(r'<SPAN class=titleblue><span id=\"lblCurTime5\">(.*)</span>') reg=re.compile(r'<td width="14%"><b>(\d+)</b>') result=reg.findall(content) current_date=date.findall(content) reg2=re.compile(r'<td align="right"><b>(.*?)</b>') yishou_area=reg2.findall(content) print current_date[0] print '一手商品房成交套数:%s' % result[0] print '一手商品房成交面积: %s' % yishou_area[0] sec_req=urllib2.Request(url+second_hand) sec_content=urllib2.urlopen(sec_req).read() sec_quantity=re.compile(r'<td width="30%">(\d+)</td>') sec_result=sec_quantity.findall(sec_content) second_area=re.findall(r'<td align="right">(.*?)</td>',sec_content) print '二手商品房成交套数:%s' % sec_result[1] print '二手商品房成交面积: %s' % second_area[2] database.create_table() database.insert(current_date[0],result[0],yishou_area[0],sec_result[1],second_area[2]) getContent() github代码:https://github.com/Rockyzsu/house
相关文章推荐
- VC编程实现IE7 IE8 IE9自动完成口令获取
- socket编程中如何实现自动获取本机IP地址和随机获取一个没有占用的端口
- 编程实现网页表单数据的自动提交
- 编程实现WINDOWS自动登陆
- 编程实现Windows系统自动登录
- winform编程textBox控件实现google搜索的自动完成功能
- 使用VB实现Excel自动获取外部数据
- 利用VC++编程实现程序自动启动
- 利用VC++编程实现程序自动启动
- 在shell中编程实现获取c函数输出
- [Flex]Flex编程注意之自动获取焦点、监听全局键盘事件
- 多线程编程之使用工作线程实现文档自动保存(I)
- 获取实现输入本月1号到今天的每天日期
- 利用VC++编程实现程序自动启动(转)
- jsp实现后台提交编程代码自动生成器
- 利用VC++编程实现程序自动启动
- 利用VC++编程实现程序自动启动
- 编程实现针对S60手机的自动开机
- 用c++函数编程实现三角形的面积
- SQL Server中自动获取类似"F100"的存储过程实现