从'span'中提取特定信息,并使用美丽汤'td'锚标签



这个问题有点蹩脚:我在这个网站页面上使用Beautiful soup, url = 'http://www.rentatbelleparkeast.com/Apartments/module/property_info/property%5Bid%5D/13578/',提取以下信息。1. 名字2. 地址3.电话4. 公寓价格(租金,布局,床/浴室/大小。我有以下简单的代码,但我没有正确的锚标记来提取实际信息。我在搜索结果中得到空白(无)。

import urllib
from BeautifulSoup import *
url = 'http://www.rentatbelleparkeast.com/Apartments/module/property_info/property%5Bid%5D/13578/'
html = urllib.urlopen(url).read()
#Create beautiful soup object
soup = BeautifulSoup(html)
print soup
# Retrieve a list of the anchor tags
# Each tag is like a dictionary of HTML attributes
#For Phone I use tag 'span'
tag = soup('span')
#I search for Phone tag but this gives blank output
phone = soup.find(text= 'Phone: ')

# I use tag 'td' to get all information from the tables
tab = soup.findAll('td')
print tab # This gives the object with all information I need
#I extract, for example, Rent using the following loop. I get blank (None) results
for i in tab:
    print i.get('Rent *', None)

姓名、地址和电话都可以用

name = ' '.join(soup.find('div', {'class': 'limitedTitle'}).text.split())
adress = ' '.join(soup.find('div', {'class': 'limitedText'}).text.split())
phone = ''.join(soup.find('div', {'class': 'propertyContactText'}).text.split())