如何使用正則表達式使用Python如何使用Python正則表達式獲取Image src?
<td width="80" align="center" valign="top"><font style="font-size:85%;font-family:arial,sans-serif"><a href="http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNFqz8ZCIf6NjgPPiTd2LIrByKYLWA&url=http://www.news.com.au/business/spain-victory-faces-market-test/story-fn7mjon9-1226390697278"><img src="//nt3.ggpht.com/news/tbn/380jt5xHH6l_FM/6.jpg" alt="" border="1" width="80" height="80" /><br /><font size="-2">NEWS.com.au</font></a></font></td>
從以下HTML字符串得到的圖像的src我試圖用
matches = re.search('@src="([^"]+)"',text)
print(matches[0])
,但一無所獲
什麼是 '@' 字符應該匹配?輸入字符串中沒有這樣的字符。 –
正則表達式和html? – Ben
http://stackoverflow.com/a/1732454/311220的 – Acorn