Skip to content

Instantly share code, notes, and snippets.

@RodrigoPrior
Created November 9, 2012 03:35
Show Gist options
  • Save RodrigoPrior/4043550 to your computer and use it in GitHub Desktop.
Save RodrigoPrior/4043550 to your computer and use it in GitHub Desktop.
retrieve multiple pages and find string in it
#!/usr/bin/python
import re,urllib2,urllib
list_ids = ( '1', '2', '3')
url = 'https://<url>/<path>/file.php?id='
regex = '[0-9]{2}\/[0-9]{11}\-[0-9]'
for i in list_ids:
link = url + i
htmlpage = urllib2.urlopen(link).read()
m = re.findall(regex, htmlpage)
print "%s;%s" % (i, m[0:1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment