python爬取房天下数据Demo

 import requests
from bs4 import BeautifulSoup
res = requests.get('http://sh.esf.fang.com/chushou/3_328298194.htm?channel=1,2&psid=1_37_70')
soup = BeautifulSoup(res.text,'html.parser')
info = {}
info['标题'] = soup.select('.title h1')[0].text.strip()
info['总价'] = soup.select('.price_esf i')[0].text
values = soup.select('div .tt')
keys = soup.select('.tab-cont-right .clearfix .font14')
del keys[-1]
i = 0
length = len(keys)
while i < length:
info[keys[i].text] = values[i].text
i += 1
info
上一篇:Java ArrayList add(int index, E element) example


下一篇:套用GGTalk做项目的经验总结——GGTalk源码详解系列(一)