我需要从这个网站得到房间列表:http://www.studentroom.ch/en/dynasite.cfm?dsmid=106547
我使用BeautifulSoup4来解析页面。 这是我一直写的代码:
from bs4 import BeautifulSoup
import urllib
pageFile = urllib.urlopen("http://studentroom.ch/dynasite.cfm?dsmid=106547")
pageHtml = pageFile.read()
pageFile.close()
soup = BeautifulSoup("".join(pageHtml))
roomsNoFilter = soup.find('div', {"id": "ImmoListe"})
rooms = roomsNoFilter.table.find_all('tr', recursive=False)
for room in rooms:
print room
print "----------------"
print len(rooms)
现在我只想得到表中的行。 但我只有7行而不是78行(或77行)。在
一开始我强硬地说我只收到了一部分html,但我打印了整个html,而且我收到的是正确的。 没有ajax调用在页面加载后加载新行。。。在
有人能帮我找出错误吗?在
这对我有用
告诉我情况
相关问题 更多 >
编程相关推荐