Hello,
I am ready to run this code but before I want to fix the exception handling:
for l in bios:
OpenThisLink = url + l
try:
response = urllib2.urlopen(OpenThisLink)
except urllib2.HTTPError:
pass
bio = response.read()
item = re.search('(JD)(.*?)(\d+)', bio)
....
As suggested here, I added the try...except
but now if a page doesn't open I get this error:
bio = response.read()
NameError: name 'response' is not defined
So the program continues to execute. Instead I want it to go back to the for loop and try the next url. I tried break
instead of pass
but that ends the program. Any suggestions?