在BeautifulSoup中匹配部分ID [英] Matching partial ids in BeautifulSoup
本文介绍了在BeautifulSoup中匹配部分ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 BeautifulSoup .我必须找到对ID为post-#
的<div>
标签的任何引用.
I'm using BeautifulSoup. I have to find any reference to the <div>
tags with id like: post-#
.
例如:
<div id="post-45">...</div>
<div id="post-334">...</div>
我尝试过:
html = '<div id="post-45">...</div> <div id="post-334">...</div>'
soupHandler = BeautifulSoup(html)
print soupHandler.findAll('div', id='post-*')
我该如何过滤?
推荐答案
查看全文