Matching id's in BeautifulSoup

Posted by Ockonal on Stack Overflow See other posts from Stack Overflow or by Ockonal
Published on 2010-05-13T21:42:23Z Indexed on 2010/05/13 21:44 UTC
Read the original article Hit count: 163

Filed under:
|

Hello, I'm using BeautifulSoup - python module. I have to find any reference to the div's with id like: 'post-#'. For example:

<div id="post-45">...</div>
<div id="post-334">...</div>

How can I filter this?

html = '<div id="post-45">...</div> <div id="post-334">...</div>'
soupHandler = BeautifulSoup(html)
print soupHandler.findAll('div', id='post-*')
> []

© Stack Overflow or respective owner

Related posts about python

Related posts about beautifulsoup