import re
start = time.time()
pattern = "and the next nothing is (\d+)"
re_url = "http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing="
nothing = "6711"
url = urlopen(re_url + nothing)
strs = url.read()
obj = re.search(pattern,strs)
while obj:
nothing = obj.group(1)
url = urlopen(re_url + nothing)
strs = url.read()
obj = re.search(pattern,strs)
print obj.group(1)
#http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=16044
#Yes. Divide by two and keep going.
#http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=160
#and the next nothing is 33774
#http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=66831
#peak.html
#http://www.pythonchallenge.com/pc/def/peak.html
#....