擅长:python、mysql、java
<p>使用pyparsing搜索标记相当直观:</p>
<pre><code>from pyparsing import makeHTMLTags, withAttribute
imgTag,notused = makeHTMLTags('img')
# only retrieve <img> tags with class='bpImage'
imgTag.setParseAction(withAttribute(**{'class':'bpImage'}))
for img in imgTag.searchString(html):
print img.src
</code></pre>