- click the picture, you will know that it will be an exhausted work
- knowing from source page, we should keep modifying the nothing value for at most 400 times
import urllib
import re
link = "http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing="
var = 12345
next_var = 0
for i in range(400):
new_link = link + str(var)
f = urllib.urlopen(new_link)
urlcontent = f.read()
try:
next_var = re.findall("and the next nothing is (\d+)", urlcontent)
var = int(''.join(next_var))
print i, var
f.close()
except:
print urlcontent
break
- Until nothing value is 16044, it will show "Yes. Divide by two and keep going."- Just restart by setting the value as 8022. At least we know we're toward the right direction~
- Until the nothing value is set as 66831, it will show "peak.html," it is the solution for this level.
沒有留言:
張貼留言