【发布时间】:2013-09-13 15:52:50
【问题描述】:
我目前正在使用 BeautifulSoup findAll 函数来提取网页所需的属性。但是,它无法获得所有所需的部分,并为某些部分返回 None。我的python代码是这样的:
from bs4 import BeautifulSoup
import urllib
url = 'http://code.google.com/p/android/issues/detail?id=1060&colspec=ID Type Status Owner Summary Stars Opened Closed Modified Reporter Cc Project Reportedby Priority Version Target Milestone Component MergedInto BlockedOn Blocking Blocked Subcomponent Attachments'
issue_page = urllib.urlopen(url).read()
soup = BeautifulSoup(issue_page)
comment_parts = soup.findAll(name = 'div',attrs={'class':'cursor_off vt issuecomment'})
for comment_part in comment_parts:
print str(comment_part)+'\n'
只获取前 48 个,不返回第 49 个和后续的。我查看了对应的html页面的源码,第49个和第48个和之前的一样。我真的想不通为什么会这样!有没有人可以帮帮我?非常感谢!
【问题讨论】:
标签: python beautifulsoup