Archive for September 10, 2007

Python Challenge level 4: “follow the chain”

Level 4 requires some web scraping. Nice :) Hint 1: urllib may help. DON’T TRY ALL NOTHINGS, since it will never end. 400 times is more than enough Hint 2: linkedlist.php?nothing=12345 import urllib,re url=’http://www.pythonchallenge.com/pc/def/ linkedlist.php?nothing=’ seed=”12345″ for i in range(400): text=urllib.urlopen(url+seed).read() seed=”".join(re.findall(r”nothing is (\d+)”,text)) try : int(seed) print ” Next:”,seed except : print ” Last:”,text [...]

Read the rest of this entry »