python beautiful soup 搜索 tag b 及其内容 abc:

mfcappwizard 2016-08-29 04:16:22
<b>abc:</b>
<b>def:</b>
<b>hijk:</b>

我现在想搜出带有def的tag

tag = bsoup.find('b', text='def')

这种方式是搜不出来的,正确的格式是什么
...全文
507 5 打赏 收藏 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
shaode01 2016-09-10
  • 打赏
  • 举报
回复
先find_all然后for item in result:if item.string.find(def)>0
mfcappwizard 2016-08-30
  • 打赏
  • 举报
回复
能否写个例子
oraclecx 2016-08-29
  • 打赏
  • 举报
回复
get_text()和正则表达式一起配合使用
mfcappwizard 2016-08-29
  • 打赏
  • 举报
回复
只想提取出第二个有 def的那个
oraclecx 2016-08-29
  • 打赏
  • 举报
回复
findall

37,737

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧