# -*- coding: utf-8 -*-

"""

Created on Fri Aug 31 2018

@author: chenlinlab

"""

from selenium import webdriver

from time import sleep

options = webdriver.ChromeOptions()

options.add_argument('disable-infobars')

driver = webdriver.Chrome(chrome_options=options)

with open('wuhan.txt', "a+") as f:

for i in range(1, 4):

driver.get("http://wh.ziroom.com/z/nl/z2-s2%E5%8F%B7%E7%BA%BF-t%E5%85%89%E8%B0%B7%E5%B9%BF%E5%9C%BA-r4.html?p=" + str(i))

sleep(1)

rent_list = driver.find_elements_by_css_selector('li.clearfix')

for echo_house in rent_list:

txt = echo_house.find_element_by_css_selector('div.txt')

print(txt.text)

detail = echo_house.find_element_by_css_selector('div.detail')

print(detail.text)

price = echo_house.find_element_by_css_selector('div.priceDetail')

print(price.text)

f.write(txt.text)

f.write(detail.text)

f.write(price.text)

f.close()

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐