如何选择此页中的所有标题
http://bulletin.columbia.edu/columbia-college/departments-instruction/african-american-studies/#coursestext
例如:我试图得到与此类似的所有行:
AFAS C1001 Introduction to African-American Studies. 3 points.
主页面从这里遍历了所有的学校课程,所以我可以抓取上面的所有标题:
http://bulletin.columbia.edu/columbia-college/departments-instruction/
for page in main_page:
sub_abbrev = page.find("div", {"class": "courseblock"})
我有这个代码,但我不知道如何选择第一个孩子的所有('strong')标记。 使用最新的python和beautiful soup 4进行web刮取。 如果还有什么需要的话。 谢谢
用} and ^{} methods 的工作示例:
courseblock
类迭代元素,然后,对于每个过程,用courseblocktitle
类获取元素。使用^{印刷品:
来自@double\u j的一个很好的后续问题:
我考虑过使用^{} method 的
separator
参数,但这也会在最后一个点之前增加一个额外的空间。相反,我将通过str.join()
加入strong
元素文本:相关问题 更多 >
编程相关推荐