从品牌网站建设到网络营销策划,从策略到执行的一站式服务
import requests
from bs4 import BeautifulSoup
def getpage(url):
responce = requests.get(url)
soup = BeautifulSoup(responce.text,'lxml')
return soup
def getlinks(link_url):
responce = requests.get(link_url)
format_list = BeautifulSoup(responce.text,'lxml')
link_div = format_list.find_all('div',class_='pic-panel')
links = [div.a.get('href') for div in link_div]
return links
url = 'https://bj.lianjia.com/zufang/'
house_url = 'https://bj.lianjia.com/zufang/101102926709.html'
def get_house_info(house_url):
# li = getlinks(url)
# print(li)
soup = getpage(house_url)
prince = soup.find('span',class_='total').text
unit = soup.find('span',class_='unit').text.strip()
house_info = soup.find_all('p')
area = house_info[0].text[3:]
layout = house_info[1].text[5:]
floor = house_info[2].text[3:]
direction = house_info[3].text[5:]
location = house_info[4].text[3:]
xiaoqu_location = house_info[5].text[3:7]
create_time = house_info[6].text[3:]
info ={'面积':area,
'分布':layout,
'楼层':floor,
'方向':direction,
'价格':prince,
'单价':unit,
'地铁':location,
'小区':xiaoqu_location,
'时间':create_time
}
return info
house = get_house_info(house_url)
for k,v in house.items():
print('{}:{}'.format(k,v))
成都网站建设公司地址:成都市青羊区太升南路288号锦天国际A座10层 建设咨询028-86922220
成都快上网科技有限公司-四川网站建设设计公司 | 蜀ICP备19037934号 Copyright 2020,ALL Rights Reserved cdkjz.cn | 成都网站建设 | © Copyright 2020版权所有.
专家团队为您提供成都网站建设,成都网站设计,成都品牌网站设计,成都营销型网站制作等服务,成都建网站就找快上网! | 成都网站建设哪家好? | 网站建设地图