これは、ライブラリなしでそれを行うための迅速で醜い方法です。
"""
>>> get_src(data)
['http://www.askgamblers.com/cache/97299a130feb2e59a08a08817daf2c0e6825991f_begado-casino-logo-review1.jpg', 'http://feeds.feedburner.com/~r/AskgamblesCasinoNews/~4/SXhvCskjiYo']
"""
data = """<img src="http://www.askgamblers.com/cache/97299a130feb2e59a08a08817daf2c0e6825991f_begado-casino-logo-review1.jpg" /><br/>
Begado is the newest online casino in our listings. As the newest
member of the Affactive group, Begado features NuWorks slots and games
for both US and international players.
<img src="http://feeds.feedburner.com/~r/AskgamblesCasinoNews/~4/SXhvCskjiYo" height="1" width="1"/>"""
def get_src(lines):
srcs = []
for line in data.splitlines():
i = line.find('src=') + 5
f = line.find('"', i)
if i > 0 and f > 0:
srcs.append(line[i:f])
return srcs
ただし、Beatiful Soupを使用することをお勧めします。これは、実際のWeb(壊れたHTMLなど)を処理するように設計された非常に優れたライブラリです。データが有効なXMLの場合は、Python標準ライブラリのElementTreeを使用できます。