如果我使用以下命令找到某个标签beautifulsoup:
styling = paragraphs.find_all('w:rpr')
我看下一个标签。如果它是标签,我只想使用该<w:t>标签。如何检查下一个标签是什么类型的标签?
我尝试element.find_next_sibling().startswith('<w:t')了该元素,但它说NoneType object is not callable。我也试过element.find_next_sibling().find_all('<w:t'>),但它没有返回任何东西。
for element in styling:
next = element.find_next_sibling()
if(#next is a <w:t> tag):
...
我正在使用beautifulsoup并希望坚持使用它,eTree如果可能的话,不要使用 bs4 添加或其他解析器。