defget_content(url): page = urllib.urlopen(url) html = page.read() return html
pattern = re.compile('a class="download" href="(.*?)"') for i inrange(1, 42, 1): page_url = 'http://subtlepatterns.com/page/%d/' % i content = get_content(page_url) finds = pattern.findall(content) if finds: for down in finds: print(down) time.sleep(0.5)