import re
import urllib2
PREFIX = "www.example.net/images/"
images = []
apat = re.compile(r'^<a.*href=["|'']([^"'']*)["|'']', re.IGNORECASE)
cpat = re.compile(r'(<[^>]*>)')
def readurl(url):
r = urllib2.urlopen(url)
s = ''
while True:
line = r.read(1024)
s += line
if len(line) < 1024:
break
return s
s = readurl(PREFIX)
l = cpat.split(s)
i = 0
while i < len(l):
if l[i].startswith('<A HREF'):
images.append(apat.match(l[i]).group(1))
i = i + 1
for i in images:
print PREFIX + i