尝试使用beautiful soup(它是一个“tag”对象)获取这种类型的html片段的内容。你知道吗
<span class="font5"> arrives at this calculation from the Torah’s report that the deluge (rains) began on the 17<sup>th</sup> day of the second month </span>
我试过:
soup.contents.find_all('span')
soup.find_all('span')
soup.find_all(re.compile("font[0-9]+"))
soup.string
soup.child
而这些似乎都不起作用。我能做什么?你知道吗
soup.find_all('span')
有效;返回所有span
标记。你知道吗如果要获取带有
font<N>
类的span
标记,请将模式指定为关键字参数class_
:(回答here)
如果以font开头足够独特,您还可以使用css选择器查找以font开头的类:
相关问题 更多 >
编程相关推荐