如何获取span标记和元文本之间的值 [英] How to get the value between span tag and meta text

查看:128
本文介绍了如何获取span标记和元文本之间的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用BeautifulSoup。我想得到有库存的文字。谢谢。





I am using BeautifulSoup. I want to get the text "In Stock". Thanks.


<br>
<span style="font-weight:bold;">Stock Status</span>
:In Stock
<meta content="InStock" itemprop="availability">
<br>

推荐答案

style = soup.find(''span'',{''style'':''font-weight:bold;''})

print style.next.next



现在我收到了所需的文字。
style = soup.find(''span'', {''style'':''font-weight:bold;''})
print style.next.next

Now I get the required text.


这篇关于如何获取span标记和元文本之间的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆