rendered paste bodydef Galleries(fromGallery, page='0'): in_gallery = re.compile('"(photogallery.*?|/gallery/.*?)"><img src="(.*?jpg)"') in_pgLeft = re.compile('There are.*?>(.*?) more</a>') Gallery = [] GalInfo = [] imgLeft = [] pgLeft = [] for a in in_gallery.findall(fromGallery): Gallery.append(a[0]) imgLeft.append(urllib.urlopen(url + a[0]).read()) for a in imgLeft: pgLeft.append(in_pgLeft.findall(a)) for a in pgLeft: GalInfo = int(str(a)[2:-2]) / 12 newList = map(replaceOne, GalInfo)def replaceOne(args): return (args * 1) + (args == 0)