【发布时间】:2020-09-04 22:18:00
【问题描述】:
我一直在尝试为一个项目抓取有关房地产新物业的信息数据。
当我尝试从网络获取床位数量时,我收到错误 'NoneType' object has no attribute 'get_text'。除了卧室,我还能获得其他属性。
这是我的代码:
titles = []
prices = []
super_area = []
bhk = []
move = []
for post in item:
title = post.find(id='srp_tuple_property_title').get_text().strip()
price = post.find(id='srp_tuple_price').get_text().strip()
area = post.find(id='srp_tuple_primary_area').get_text().strip()
moves = post.find(class_='badges__secondaryLargeSubtle').get_text().strip()
bed = post.find(id='srp_tuple_bedroom').get_text().strip()
bhk.append(bed)
move.append(moves)
super_area.append(area)
prices.append(price)
titles.append(title)
【问题讨论】:
标签: python dataframe web-scraping data-science web-scraping-language