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
python
|beautifulsoup
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